Sfoglia il codice sorgente

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

Prevent NULL dereference if kmalloc() fails.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Roel Kluin 15 anni fa
parent
commit
1601fb1498
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      drivers/media/dvb/dvb-usb/m920x.c

+ 2 - 0
drivers/media/dvb/dvb-usb/m920x.c

@@ -337,6 +337,8 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar
 	int i, pass, ret = 0;
 	int i, pass, ret = 0;
 
 
 	buff = kmalloc(65536, GFP_KERNEL);
 	buff = kmalloc(65536, GFP_KERNEL);
+	if (buff == NULL)
+		return -ENOMEM;
 
 
 	if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
 	if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
 		goto done;
 		goto done;