Skip to content

Commit e1e6b84

Browse files
committed
nvme: update device error handling for list-subsys
The list-subsys command does not properly check if the nvme device passed to the <device> option is a valid device or not. Fix the same. Signed-off-by: Martin George <[email protected]>
1 parent cba763f commit e1e6b84

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

nvme.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3422,6 +3422,7 @@ static int list_subsys(int argc, char **argv, struct command *cmd,
34223422
struct plugin *plugin)
34233423
{
34243424
_cleanup_nvme_root_ nvme_root_t r = NULL;
3425+
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
34253426
nvme_print_flags_t flags;
34263427
const char *desc = "Retrieve information for subsystems";
34273428
nvme_scan_filter_t filter = NULL;
@@ -3461,6 +3462,10 @@ static int list_subsys(int argc, char **argv, struct command *cmd,
34613462
if (devname) {
34623463
int subsys_num;
34633464

3465+
err = parse_and_open(&dev, argc, argv, desc, opts);
3466+
if (err)
3467+
return err;
3468+
34643469
if (sscanf(devname, "nvme%dn%d", &subsys_num, &nsid) != 2) {
34653470
nvme_show_error("Invalid device name %s", devname);
34663471
return -EINVAL;

0 commit comments

Comments
 (0)