Skip to contentSkip to conversation

V4L/DVB (7969): kmalloc failure ignored in m920x_firmware_download()

PATCH New Roel Kluin 1 participant 1 message Sep 18, 2009 Media (V4L/DVB)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 V4L/DVB (7969): kmalloc failure ignored in m920x_firmware_download()

Prevent NULL dereference if kmalloc() fails.

---
Found with sed: http://kernelnewbies.org/roelkluin

Build tested.

drivers/media/dvb/dvb-usb/m920x.c +2 -0
index aec7a19..ef9b7be 100644
@@ -337,6 +337,8 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar
 	int i, pass, ret = 0;
 
 	buff = kmalloc(65536, GFP_KERNEL);
+	if (buff == NULL)
+		return -ENOMEM;
 
 	if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
 		goto done;