Patchwork atm: dereference of he_dev->rbps_virt in he_init_group()

login
register
mail settings
Submitter roel kluin
Date Aug. 29, 2009, 6:56 p.m.
Message ID <4A9979CC.2090905@gmail.com>
Download mbox | patch
Permalink /patch/32508/
State Superseded
Delegated to: David Miller
Headers show

Comments

roel kluin - Aug. 29, 2009, 6:56 p.m.
he_dev->rbps_virt allocation may fail.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 2de6406..2d766d6 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -795,6 +795,8 @@  he_init_group(struct he_dev *he_dev, int group)
 	}
 	memset(he_dev->rbps_base, 0, CONFIG_RBPS_SIZE * sizeof(struct he_rbp));
 	he_dev->rbps_virt = kmalloc(CONFIG_RBPS_SIZE * sizeof(struct he_virt), GFP_KERNEL);
+	if (he_dev->rbps_virt == NULL)
+		return -ENOMEM;
 
 	for (i = 0; i < CONFIG_RBPS_SIZE; ++i) {
 		dma_addr_t dma_handle;