Linux-SCSI Archive on lore.kernel.org
 help / color / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: zhengbin <zhengbin13@huawei.com>,
	jejb@linux.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org
Cc: yi.zhang@huawei.com
Subject: Re: [PATCH] scsi: core: fix uninit-value access of variable sshdr
Date: Fri, 11 Oct 2019 10:17:54 -0700
Message-ID: <8be12c02-9055-0129-8f40-5030d6c31fd6@acm.org> (raw)
In-Reply-To: <1570709143-147364-1-git-send-email-zhengbin13@huawei.com>

On 10/10/19 5:05 AM, zhengbin wrote:
> +	/*
> +	 * need to initial sshdr to avoid uninit-value access
> +	 */
> +	if (sshdr)
> +		memset(sshdr, 0, sizeof(struct scsi_sense_hdr));
> +

I think the above comment is slightly confusing because it is correct 
for some callers but not for all callers of scsi_execute(). How about 
changing the comment into something like the following: "Zero-initialize 
sshdr for those callers that check the *sshdr contents even if no sense 
data is available"?

Thanks,

Bart.

      parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 12:05 zhengbin
2019-10-10 17:03 ` Bart Van Assche
2019-10-11  3:07   ` zhengbin (A)
2019-10-11 17:15     ` Bart Van Assche
2019-10-11 17:17 ` Bart Van Assche [this message]

Reply instructions:

You may reply publically 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=8be12c02-9055-0129-8f40-5030d6c31fd6@acm.org \
    --to=bvanassche@acm.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=yi.zhang@huawei.com \
    --cc=zhengbin13@huawei.com \
    /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

Linux-SCSI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-scsi/0 linux-scsi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-scsi linux-scsi/ https://lore.kernel.org/linux-scsi \
		linux-scsi@vger.kernel.org linux-scsi@archiver.kernel.org
	public-inbox-index linux-scsi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-scsi


AGPL code for this site: git clone https://public-inbox.org/ public-inbox