]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme: Don't seg fault if given device is not char/block device
authorNilay Shroff <nilay@linux.ibm.com>
Sun, 17 Mar 2024 11:36:22 +0000 (17:06 +0530)
committerDaniel Wagner <dwagner@suse.de>
Wed, 20 Mar 2024 07:15:07 +0000 (08:15 +0100)
commitfbb331106339de6c92ba520f1757a80802ab95e9
tree55af6382099e5ba43d10432b61aadda18c6d5b25
parent89372aa8470e2d66758ceea75b618d0ad55a93f4
nvme: Don't seg fault if given device is not char/block device

If the given device name is not char/block device then in
open_dev_direct() set errno to ENODEV and err to -1 before
returning to the dev_fd(). This would then ensure that in
case of error, dev_fd() returns the corerct negative error
code back to its callers. So now the callers of dev_fd()
would handle the error appropriately instead of try
accessing the nvme_dev which would be NULL.

Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme.c