Re: [PATCH] scsi: dc395x.c: Fix for possible null pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
> ---
>  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/
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux