lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <504557A5.1040500@broadcom.com>
Date:	Mon, 3 Sep 2012 18:21:41 -0700
From:	"Bhanu Prakash Gollapudi" <bprakash@...adcom.com>
To:	"Andi Kleen" <andi@...stfloor.org>
cc:	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
	"James Bottomley" <jbottomley@...allels.com>
Subject: Re: [PATCH] Fix incorrect memset in bnx2fc_parse_fcp_rsp

On 9/3/2012 11:50 AM, Andi Kleen wrote:
> gcc 4.8 warns because the memset only clears sizeof(char *) bytes, not
> the whole buffer. Use the correct buffer size and clear the whole sense
> buffer.
>
> /backup/lsrc/git/linux-lto-2.6/drivers/scsi/bnx2fc/bnx2fc_io.c: In
> function 'bnx2fc_parse_fcp_rsp':
> /backup/lsrc/git/linux-lto-2.6/drivers/scsi/bnx2fc/bnx2fc_io.c:1810:41:
> warning: argument to 'sizeof' in 'memset' call is the same expression as
> the destination; did you mean to provide an explicit length?
> [-Wsizeof-pointer-memaccess]
>     memset(sc_cmd->sense_buffer, 0, sizeof(sc_cmd->sense_buffer));
>                                           ^
>
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
>
>
>
> diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
> index 73f231c..8d4626c 100644
> --- a/drivers/scsi/bnx2fc/bnx2fc_io.c
> +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
> @@ -1807,7 +1807,7 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
>   			fcp_sns_len = SCSI_SENSE_BUFFERSIZE;
>   		}
>
> -		memset(sc_cmd->sense_buffer, 0, sizeof(sc_cmd->sense_buffer));
> +		memset(sc_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
>   		if (fcp_sns_len)
>   			memcpy(sc_cmd->sense_buffer, rq_data, fcp_sns_len);
>
>
Thanks Andi. Looks good to me.

Acked-by: Bhanu Prakash Gollapudi <bprakash@...adcom.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ