* [PATCH] scsi: dc395x.c: Fix for possible null pointer dereference
@ 2014-05-18 16:09 Rickard Strandqvist
2014-05-18 19:50 ` Guennadi Liakhovetski
0 siblings, 1 reply; 4+ messages in thread
From: Rickard Strandqvist @ 2014-05-18 16:09 UTC (permalink / raw)
To: Oliver Neukum, Ali Akcaagac
Cc: Rickard Strandqvist, Jamie Lenehan, James E.J. Bottomley, dc395x,
linux-scsi, linux-kernel
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
drivers/scsi/dc395x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 83d9bf6..0d86bc7 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -2637,7 +2637,7 @@ static struct ScsiReqBlk *msgin_qtag(struct AdapterCtlBlk *acb,
struct ScsiReqBlk *srb = NULL;
struct ScsiReqBlk *i;
dprintkdbg(DBG_0, "msgin_qtag: (0x%p) tag=%i srb=%p\n",
- srb->cmd, tag, srb);
+ srb ? srb->cmd : 0, tag, srb);
if (!(dcb->tag_mask & (1 << tag)))
dprintkl(KERN_DEBUG,
--
1.7.10.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: dc395x.c: Fix for possible null pointer dereference
2014-05-18 16:09 [PATCH] scsi: dc395x.c: Fix for possible null pointer dereference Rickard Strandqvist
@ 2014-05-18 19:50 ` Guennadi Liakhovetski
2014-05-19 11:39 ` Oliver Neukum
0 siblings, 1 reply; 4+ messages in thread
From: Guennadi Liakhovetski @ 2014-05-18 19:50 UTC (permalink / raw)
To: Rickard Strandqvist
Cc: Oliver Neukum, Ali Akcaagac, Jamie Lenehan, James E.J. Bottomley,
dc395x, linux-scsi, linux-kernel
On Sun, 18 May 2014, Rickard Strandqvist wrote:
> There is otherwise a risk of a possible null pointer dereference.
>
> Was largely found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/scsi/dc395x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
> index 83d9bf6..0d86bc7 100644
> --- a/drivers/scsi/dc395x.c
> +++ b/drivers/scsi/dc395x.c
> @@ -2637,7 +2637,7 @@ static struct ScsiReqBlk *msgin_qtag(struct AdapterCtlBlk *acb,
> struct ScsiReqBlk *srb = NULL;
> struct ScsiReqBlk *i;
> dprintkdbg(DBG_0, "msgin_qtag: (0x%p) tag=%i srb=%p\n",
> - srb->cmd, tag, srb);
> + srb ? srb->cmd : 0, tag, srb);
There's not just a risk, it is a NULL-pointer dereference, so, just remove
it, e.g. like
> - dprintkdbg(DBG_0, "msgin_qtag: (0x%p) tag=%i srb=%p\n",
> - srb->cmd, tag, srb);
> + dprintkdbg(DBG_0, "msgin_qtag: tag=%i\n", tag);
Thanks
Guennadi
> if (!(dcb->tag_mask & (1 << tag)))
> dprintkl(KERN_DEBUG,
> --
> 1.7.10.4
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: dc395x.c: Fix for possible null pointer dereference
2014-05-18 19:50 ` Guennadi Liakhovetski
@ 2014-05-19 11:39 ` Oliver Neukum
2014-05-20 21:20 ` Rickard Strandqvist
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Neukum @ 2014-05-19 11:39 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: Rickard Strandqvist, Ali Akcaagac, Jamie Lenehan,
James E.J. Bottomley, dc395x, linux-scsi, linux-kernel
On Sun, 2014-05-18 at 21:50 +0200, Guennadi Liakhovetski wrote:
> On Sun, 18 May 2014, Rickard Strandqvist wrote:
>
> > There is otherwise a risk of a possible null pointer dereference.
> >
> > Was largely found by using a static code analysis program called cppcheck.
> >
> > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> > ---
> > drivers/scsi/dc395x.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
> > index 83d9bf6..0d86bc7 100644
> > --- a/drivers/scsi/dc395x.c
> > +++ b/drivers/scsi/dc395x.c
> > @@ -2637,7 +2637,7 @@ static struct ScsiReqBlk *msgin_qtag(struct AdapterCtlBlk *acb,
> > struct ScsiReqBlk *srb = NULL;
> > struct ScsiReqBlk *i;
> > dprintkdbg(DBG_0, "msgin_qtag: (0x%p) tag=%i srb=%p\n",
> > - srb->cmd, tag, srb);
> > + srb ? srb->cmd : 0, tag, srb);
>
> There's not just a risk, it is a NULL-pointer dereference, so, just remove
> it, e.g. like
Indeed. Thank you both for catching this.
Regards
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: dc395x.c: Fix for possible null pointer dereference
2014-05-19 11:39 ` Oliver Neukum
@ 2014-05-20 21:20 ` Rickard Strandqvist
0 siblings, 0 replies; 4+ messages in thread
From: Rickard Strandqvist @ 2014-05-20 21:20 UTC (permalink / raw)
To: Oliver Neukum
Cc: Guennadi Liakhovetski, Ali Akcaagac, Jamie Lenehan,
James E.J. Bottomley, dc395x, linux-scsi, linux-kernel
Okay, good!
Or, do I need to do anything else :-)
Best regards
Rickard Strandqvist
2014-05-19 13:39 GMT+02:00 Oliver Neukum <oneukum@suse.de>:
> On Sun, 2014-05-18 at 21:50 +0200, Guennadi Liakhovetski wrote:
>> On Sun, 18 May 2014, Rickard Strandqvist wrote:
>>
>> > There is otherwise a risk of a possible null pointer dereference.
>> >
>> > Was largely found by using a static code analysis program called cppcheck.
>> >
>> > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
>> > ---
>> > drivers/scsi/dc395x.c | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
>> > index 83d9bf6..0d86bc7 100644
>> > --- a/drivers/scsi/dc395x.c
>> > +++ b/drivers/scsi/dc395x.c
>> > @@ -2637,7 +2637,7 @@ static struct ScsiReqBlk *msgin_qtag(struct AdapterCtlBlk *acb,
>> > struct ScsiReqBlk *srb = NULL;
>> > struct ScsiReqBlk *i;
>> > dprintkdbg(DBG_0, "msgin_qtag: (0x%p) tag=%i srb=%p\n",
>> > - srb->cmd, tag, srb);
>> > + srb ? srb->cmd : 0, tag, srb);
>>
>> There's not just a risk, it is a NULL-pointer dereference, so, just remove
>> it, e.g. like
>
> Indeed. Thank you both for catching this.
>
> Regards
> Oliver
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-20 21:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-18 16:09 [PATCH] scsi: dc395x.c: Fix for possible null pointer dereference Rickard Strandqvist
2014-05-18 19:50 ` Guennadi Liakhovetski
2014-05-19 11:39 ` Oliver Neukum
2014-05-20 21:20 ` Rickard Strandqvist
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®