Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions libnvme/src/nvme/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,12 @@ static int nvme_discovery_log(libnvme_ctrl_t ctrl,
struct libnvme_transport_handle *hdl;

hdl = libnvme_ctrl_get_transport_handle(ctrl);
if (!hdl) {
libnvme_msg(ctx, LIBNVME_LOG_DEBUG,
"%s: failed to get discovery log, device not accessible\n",
name);
return -ENODEV;
}
struct libnvme_passthru_cmd cmd;

log = __libnvme_alloc(sizeof(*log));
Expand Down Expand Up @@ -1641,6 +1647,13 @@ static int nvmf_dim(libnvme_ctrl_t c, enum nvmf_dim_tas tas, __u8 trtype,
__u32 tel;
int ret;

if (!hdl) {
libnvme_msg(ctx, LIBNVME_LOG_DEBUG,
"%s: failed to perform DIM, device not accessible\n",
c->name);
return -ENODEV;
}

if (!c->s) {
libnvme_msg(ctx, LIBNVME_LOG_ERR,
"%s: failed to perform DIM. subsystem undefined.\n",
Expand Down
2 changes: 2 additions & 0 deletions libnvme/src/nvme/nvme-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ __public int libnvme_get_log(struct libnvme_transport_handle *hdl,
struct libnvme_passthru_cmd *cmd, bool rae,
__u32 xfer_len)
{
if (!hdl)
return -ENODEV; /* safety net; callers must validate hdl */
__u64 offset = 0, xfer, data_len = cmd->data_len;
__u64 start = (__u64)cmd->cdw13 << 32 | cmd->cdw12;
__u64 lpo;
Expand Down
6 changes: 6 additions & 0 deletions libnvme/src/nvme/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,12 @@ __public int libnvme_ctrl_identify(libnvme_ctrl_t c, struct nvme_id_ctrl *id)
libnvme_ctrl_get_transport_handle(c);
struct libnvme_passthru_cmd cmd;

if (!hdl) {
libnvme_msg(c->ctx, LIBNVME_LOG_DEBUG,
"%s: failed to identify ctrl, device not accessible\n",
c->name);
return -ENODEV;
}
nvme_init_identify_ctrl(&cmd, id);
return libnvme_submit_admin_passthru(hdl, &cmd);
}
Expand Down
Loading