Skip to contentSkip to conversation

Fix a potential NULL pointer deref in the aic7xxx, ahc_print_register() function

PATCH In review [email protected] 3 participants 4 messages Oct 2, 2007 – Oct 5, 2007

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

PATCH 8/17 Fix a potential NULL pointer deref in the aic7xxx, ahc_print_register() function

From: Jesper Juhl <[email protected]>

The Coverity checker noticed that we have a potential NULL pointer deref in drivers/scsi/aic7xxx/aic7xxx_core.c::ahc_print_register(). This patch handles it by adding the same test against NULL that is used elsewhere in the same function.

---

 drivers/scsi/aic7xxx/aic7xxx_core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/aic7xxx/aic7xxx_core.c renamed from drivers/scsi/aic7xxx/aic7xxx_core.c~fix-a-potential-null-pointer-deref-in-the-aic7xxx-ahc_print_register-function +2 -1
diff -puN drivers/scsi/aic7xxx/aic7xxx_core.c~fix-a-potential-null-pointer-deref-in-the-aic7xxx-ahc_print_register-function drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -6557,7 +6557,8 @@ ahc_print_register(ahc_reg_parse_entry_t
 	printed = printf("%s[0x%x]", name, value);
 	if (table == NULL) {
 		printed += printf(" ");
-		*cur_column += printed;
+		if (cur_column != NULL)
+			*cur_column += printed;
 		return (printed);
 	}
 	printed_mask = 0;

_

#1 lore raw
Quoted 9 lines · On Tue, 2007-10-02 at 14:38 -0700, [email protected] wrote:

From: Jesper Juhl <[email protected]>

The Coverity checker noticed that we have a potential NULL pointer deref in drivers/scsi/aic7xxx/aic7xxx_core.c::ahc_print_register(). This patch handles it by adding the same test against NULL that is used elsewhere in the same function.

No. Reasons formerly given here:

http://marc.info/?l=linux-scsi&m=118632919511846&w=2

James

#2 lore raw
In reply to [email protected]
Quoted 9 lines · On Tue, 2007-10-02 at 14:38 -0700, [email protected] wrote:

From: Jesper Juhl <[email protected]>

The Coverity checker noticed that we have a potential NULL pointer deref in drivers/scsi/aic7xxx/aic7xxx_core.c::ahc_print_register(). This patch handles it by adding the same test against NULL that is used elsewhere in the same function.

No. Reasons formerly given here:

http://marc.info/?l=linux-scsi&m=118632919511846&w=2

James

#3 lore raw
Quoted 8 lines · James Bottomley
Quoted 7 lines · On Tue, 2007-10-02 at 14:38 -0700, [email protected] wrote:

From: Jesper Juhl <[email protected]>

The Coverity checker noticed that we have a potential NULL pointer deref in drivers/scsi/aic7xxx/aic7xxx_core.c::ahc_print_register(). This patch handles it by adding the same test against NULL that is used elsewhere in the same function.

Quoted 7 lines
Quoted 2 lines

No. Reasons formerly given here:

http://marc.info/?l=linux-scsi&m=118632919511846&w=2

The reasons that patch sticks around was given by Andrew in a mail send to me, you and Justin Gibbs on Aug 8.

My reply to that mail (including Andrew's original) is below, but you should be able to also find it in your own archives.

Basically Andrew said:
"That's the sort of patch I keep around to prevent the issue from getting swept under the table. This usually results in me sitting on the sorry thing for literally years :("

---[ quote from old email - start ]---

Quoted 28 lines

from Jesper Juhl <[email protected]>
to Andrew Morton <[email protected]>
cc
James Bottomley <[email protected]>,
Justin T. Gibbs <[email protected]>

	date		8 Aug 2007 00:43	
	subject		Re: + avoid-a-small-unlikely-memory-leak-in-proc_read_escd.patch added to > -mm tree	
	mailed-by		gmail.com	
Quoted 11 lines · Andrew Morton
Quoted 7 lines · On Wed, 8 Aug 2007 00:26:43 +0200 "Jesper Juhl" <[email protected]> wrote:

This reply was meant for

Quoted 5 lines

The patch titled
Fix a potential NULL pointer deref in the aic7xxx, ahc_print_register() function
has been added to the -mm tree. Its filename is
fix-a-potential-null-pointer-deref-in-the-aic7xxx-ahc_print_register-function.patch

Quoted 4 lines

That's the sort of patch I keep around to prevent the issue from getting swept under the table. This usually results in me sitting on the sorry thing for literally years :(

Ok, in that case you may want to keep it around in -mm despite James' objections - I'll leave that up to you. But it probably shouldn't move towards mainline...

Quoted 7 lines
Quoted 3 lines

Feel free to send a replacement patch which gets us closer to the real fix. Remove all the NULL tests, maybe.

I don't have a good idea on how to solve this better at the moment. But if I come up with something I'll be sure to send it to you and James.

---[ quote from old email - end ]---

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html