Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@linux.intel.com (Keith Busch)
Subject: [PATCH] nvme-cli: fix get_nsid() return value check
Date: Thu, 3 May 2018 08:29:31 -0600	[thread overview]
Message-ID: <20180503142931.GL5938@localhost.localdomain> (raw)
In-Reply-To: <20180503100445.21899-1-chaitanya.kulkarni@wdc.com>

On Thu, May 03, 2018@06:04:45AM -0400, Chaitanya Kulkarni wrote:
> All the callers of the get_nsid() defined cfg.namespace_id as __u32.
> The true return value of the call:-
> 
> cfg.namespace_id = get_nsid()
> 
> will not be used in case nvme_get_nsid() returns < 0 and
> comparion of
> 
> if (cfg.namespace_id <= 0)
> 
> and will result is cfg.namespace_id > 0 due to type mismatch.
> 
> We fix this scenario by returning the 0 (invalid nsid on get_nsid()
> for nvme_get_nsid() failure case) and adding
> 
> cfg.namespace_id == 0
> 
> for error checking in all the callers of the get_nsid().

Indeed, thanks for the fix. Applied.

      reply	other threads:[~2018-05-03 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 10:04 [PATCH] nvme-cli: fix get_nsid() return value check Chaitanya Kulkarni
2018-05-03 14:29 ` Keith Busch [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=20180503142931.GL5938@localhost.localdomain \
    --to=keith.busch@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox