Skip to contentSkip to conversation

ivtv: fix NULL dereference

PATCH In review Adrian Bunk 3 participants 3 messages Oct 14, 2007 – Oct 15, 2007 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ivtv: fix NULL dereference

We shouldn't dereference "itv" when we know it's NULL...

Spotted by the Coverity checker.

---

drivers/media/video/ivtv/ivtv-fileops.c renamed from drivers/media/video/ivtv/ivtv-fileops.c.old +1 -1
@@ -947,7 +947,7 @@ int ivtv_v4l2_open(struct inode *inode, 
 	if (itv == NULL) {
 		/* Couldn't find a device registered
 		   on that minor, shouldn't happen! */
-		IVTV_WARN("No ivtv device found on minor %d\n", minor);
+		printk(KERN_WARNING "No ivtv device found on minor %d\n", minor);
 		return -ENXIO;
 	}
 
#1 lore raw
Quoted 12 lines · On Sunday 14 October 2007 19:51:37 Adrian Bunk wrote:

We shouldn't dereference "itv" when we know it's NULL...

Spotted by the Coverity checker.

---
--- linux-2.6/drivers/media/video/ivtv/ivtv-fileops.c.old 2007-10-14
19:17:12.000000000 +0200 +++
linux-2.6/drivers/media/video/ivtv/ivtv-fileops.c 2007-10-14
19:18:05.000000000 +0200 @@ -947,7 +947,7 @@ int
ivtv_v4l2_open(struct inode *inode,

drivers/media/video/ivtv/ivtv-fileops.c int ivtv_v4l2_open(struct inode *inode, · line 952

Quoted 7 lines
drivers/media/video/ivtv/ivtv-fileops.c renamed from drivers/media/video/ivtv/ivtv-fileops.c.old +1 -1
 	if (itv == NULL) {
 		/* Couldn't find a device registered
 		   on that minor, shouldn't happen! */
-		IVTV_WARN("No ivtv device found on minor %d\n", minor);
+		printk(KERN_WARNING "No ivtv device found on minor %d\n", minor);
 		return -ENXIO;
 	}

Luckily this is something that 'shoudn't happen' :-) Oddly enough it is correct in my standalone driver.

Mauro, can you merge this with 2.6.24 as well? Or shall I add it to my ivtv tree with my other outstanding fixes?

Regards,

Hans

#2 lore raw

Em Dom, 2007-10-14 às 20:03 +0200, Hans Verkuil escreveu:

Quoted 24 lines · On Sunday 14 October 2007 19:51:37 Adrian Bunk wrote:
Quoted 12 lines

We shouldn't dereference "itv" when we know it's NULL...

Spotted by the Coverity checker.

---
--- linux-2.6/drivers/media/video/ivtv/ivtv-fileops.c.old 2007-10-14
19:17:12.000000000 +0200 +++
linux-2.6/drivers/media/video/ivtv/ivtv-fileops.c 2007-10-14
19:18:05.000000000 +0200 @@ -947,7 +947,7 @@ int
ivtv_v4l2_open(struct inode *inode,

drivers/media/video/ivtv/ivtv-fileops.c int ivtv_v4l2_open(struct inode *inode, · line 952

Quoted 7 lines
drivers/media/video/ivtv/ivtv-fileops.c renamed from drivers/media/video/ivtv/ivtv-fileops.c.old +1 -1
 	if (itv == NULL) {
 		/* Couldn't find a device registered
 		   on that minor, shouldn't happen! */
-		IVTV_WARN("No ivtv device found on minor %d\n", minor);
+		printk(KERN_WARNING "No ivtv device found on minor %d\n", minor);
 		return -ENXIO;
 	}
Quoted 2 lines

Mauro, can you merge this with 2.6.24 as well? Or shall I add it to my ivtv tree with my other outstanding fixes?

I'm applying it. I prefer to handle the fix changesets first, in separate requests.

Later, I'll pull from your ivtv tree, together with the changesets you're working for 2.6.25.

Btw, as I've received the patch via Adrian's e-mail, I've changed your tag to "Reviewed-by".

Cheers,
Mauro