From: Scott Bauer Date: Thu, 16 Mar 2017 23:16:29 +0000 (-0600) Subject: Fixup Security send/recv to read data from disk X-Git-Tag: v1.3~18^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=98ac1df28d58f5319beaf568680ccd11b89c075a;p=users%2Fsagi%2Fnvme-cli.git Fixup Security send/recv to read data from disk We forgot to actually read the data from the disk into the buffer. Signed-off-by: Scott Bauer --- diff --git a/nvme.c b/nvme.c index 4b4d7faa..5fbb3630 100644 --- a/nvme.c +++ b/nvme.c @@ -1665,6 +1665,12 @@ static int sec_send(int argc, char **argv, struct command *cmd, struct plugin *p return ENOMEM; } + if (read(sec_fd, sec_buf, sec_size) < 0) { + fprintf(stderr, "Failed to read data from security file with %s\n", + strerror(errno)); + return EINVAL; + } + err = nvme_sec_send(fd, cfg.namespace_id, cfg.nssf, cfg.spsp, cfg.secp, cfg.tl, sec_size, sec_buf, &result); if (err < 0)