]>
www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme-cli: fix get_nsid() return value check
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().
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>