Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] cx231xx: dereferencing NULL after allocation failure

"dev" is NULL here so we should use "nr" instead of "dev->devno".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Dan Carpenter and committed by
Mauro Carvalho Chehab
6c2cc5b5 82033bc5

+1 -1
+1 -1
drivers/media/video/cx231xx/cx231xx-cards.c
··· 1052 1052 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 1053 1053 if (dev == NULL) { 1054 1054 cx231xx_err(DRIVER_NAME ": out of memory!\n"); 1055 - clear_bit(dev->devno, &cx231xx_devused); 1055 + clear_bit(nr, &cx231xx_devused); 1056 1056 return -ENOMEM; 1057 1057 } 1058 1058