From: Jesper Juhl <jesper.juhl@gmail.com>
To: "Justin T. Gibbs" <gibbs@scsiguy.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>,
Andrew Morton <akpm@linux-foundation.org>,
James Bottomley <jejb@kernel.org>,
linux-scsi@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Jesper Juhl <jesper.juhl@gmail.com>
Subject: Re: [PATCH][RESEND] Fix a potential NULL pointer deref in the aic7xxx, ahc_print_register() function
Date: Sun, 5 Aug 2007 17:52:05 +0200 [thread overview]
Message-ID: <200708051752.06003.jesper.juhl@gmail.com> (raw)
In-Reply-To: <46B5EFE7.6090008@scsiguy.com>
On Sunday 05 August 2007 17:42:31 Justin T. Gibbs wrote:
> All of this logic was simplified back in '05 in the BSD drivers by adding
> this to the top of the function:
>
> u_int dummy_column;
>
> if (cur_column == NULL) {
> dummy_column = 0;
> cur_column = &dummy_column;
> }
>
> and then stripping out the cur_column == NULL checks in the routine.
>
Thank you for that info.
James, if that sounds like a better way to deal with it to you, then
here's a patch to implement it.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
drivers/scsi/aic7xxx/aic7xxx_core.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 75733b0..d1f3f25 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -6529,8 +6529,14 @@ ahc_print_register(ahc_reg_parse_entry_t *table, u_int num_entries,
{
int printed;
u_int printed_mask;
+ u_int dummy_column;
- if (cur_column != NULL && *cur_column >= wrap_point) {
+ if (!cur_column) {
+ dummy_column = 0;
+ cur_column = &dummy_column;
+ }
+
+ if (*cur_column >= wrap_point) {
printf("\n");
*cur_column = 0;
}
@@ -6565,8 +6571,7 @@ ahc_print_register(ahc_reg_parse_entry_t *table, u_int num_entries,
printed += printf(") ");
else
printed += printf(" ");
- if (cur_column != NULL)
- *cur_column += printed;
+ *cur_column += printed;
return (printed);
}
next prev parent reply other threads:[~2007-08-05 15:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200708042030.52405.jesper.juhl@gmail.com>
2007-08-04 19:43 ` [PATCH][RESEND] Fix a potential NULL pointer deref in the aic7xxx, ahc_print_register() function James Bottomley
2007-08-05 15:36 ` Jesper Juhl
2007-08-05 15:42 ` Justin T. Gibbs
2007-08-05 15:52 ` Jesper Juhl [this message]
2007-08-05 15:53 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200708051752.06003.jesper.juhl@gmail.com \
--to=jesper.juhl@gmail.com \
--cc=James.Bottomley@steeleye.com \
--cc=akpm@linux-foundation.org \
--cc=gibbs@scsiguy.com \
--cc=jejb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox