Skip to contentSkip to conversation

staging: tm6000: check kzalloc() result

PATCH Applied Kulikov Vasiliy 1 participant 1 message Jul 16, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/15 staging: tm6000: check kzalloc() result

If kzalloc() fails exit with -ENOMEM.

---
 drivers/staging/tm6000/tm6000-core.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/staging/tm6000/tm6000-core.c +4 -1
index 2c38199..9c2829e 100644
@@ -40,8 +40,11 @@ int tm6000_read_write_usb(struct tm6000_core *dev, u8 req_type, u8 req,
 	static int   ini = 0, last = 0, n = 0;
 	u8	     *data = NULL;
 
-	if (len)
+	if (len) {
 		data = kzalloc(len, GFP_KERNEL);
+		if (data = NULL)
+			return -ENOMEM;
+	}
 
 
 	if (req_type & USB_DIR_IN)
Signature · 1 line
1.7.0.4