From: "Bhanu Prakash Gollapudi" <bprakash@broadcom.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
James Bottomley <jbottomley@parallels.com>
Subject: Re: [PATCH] Fix incorrect memset in bnx2fc_parse_fcp_rsp
Date: Mon, 3 Sep 2012 18:21:41 -0700 [thread overview]
Message-ID: <504557A5.1040500@broadcom.com> (raw)
In-Reply-To: <20120903185030.GV16230@one.firstfloor.org>
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@linux.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@broadcom.com>
prev parent reply other threads:[~2012-09-04 1:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-03 18:50 [PATCH] Fix incorrect memset in bnx2fc_parse_fcp_rsp Andi Kleen
2012-09-04 1:21 ` Bhanu Prakash Gollapudi [this message]
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=504557A5.1040500@broadcom.com \
--to=bprakash@broadcom.com \
--cc=andi@firstfloor.org \
--cc=jbottomley@parallels.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.