All of lore.kernel.org
 help / color / mirror / Atom feed
From: james_p_freyensee@linux.intel.com (J Freyensee)
Subject: [PATCH] nvme: initialize variable before logical OR'ing it
Date: Tue, 14 Jun 2016 16:34:57 -0700	[thread overview]
Message-ID: <1465947297.1623.3.camel@linux.intel.com> (raw)
In-Reply-To: <1464882685-4531-1-git-send-email-james.p.freyensee@intel.com>

On Thu, 2016-06-02@08:51 -0700, Jay Freyensee wrote:

Ping?

> It is typically not good coding or secure coding practice
> to logical OR a variable without an initialization value first.
> Here on this line:
> 
> integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
> 
> BLK_INTEGRITY_DEVICE_CAPABLE is being OR'ed to a member variable
> never set to an initial value. This patch fixes that.
> 
> Signed-off-by: Jay Freyensee <james.p.freyensee at intel.com>
> Reviewed-by: Ming Lin <ming.l at samsung.com>
> Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
> Reviewed-by: Christoph Hellwig <hch at lst.de>
> 
> ---
>  drivers/nvme/host/core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index f6f6fdf..33fe610 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -843,6 +843,7 @@ static void nvme_init_integrity(struct nvme_ns
> *ns)
>  {
>  	struct blk_integrity integrity;
>  
> +	memset(&integrity, 0, sizeof(integrity));
>  	switch (ns->pi_type) {
>  	case NVME_NS_DPS_PI_TYPE3:
>  		integrity.profile = &t10_pi_type3_crc;

  reply	other threads:[~2016-06-14 23:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 15:51 [PATCH] nvme: initialize variable before logical OR'ing it Jay Freyensee
2016-06-14 23:34 ` J Freyensee [this message]
2016-07-19 19:31 ` J Freyensee
2016-07-21  3:27   ` Jens Axboe
2016-07-21 16:36     ` J Freyensee

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=1465947297.1623.3.camel@linux.intel.com \
    --to=james_p_freyensee@linux.intel.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
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.