From a6ef86deb41003f02b995889528ecf9e2fac7379 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Tue, 6 Jun 2023 17:21:55 +0200 Subject: [PATCH] nvme: Use correct data buffer size The submit_io command is using the buffer size provided by the user. But this size argument might be updated and the correct length for the buffer is buffer_size. Thus use this value and not the initial length. Signed-off-by: Daniel Wagner --- nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvme.c b/nvme.c index 7e877fb4..b5b05857 100644 --- a/nvme.c +++ b/nvme.c @@ -7672,7 +7672,7 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char } else if (err) { nvme_show_status(err); } else { - if (!(opcode & 1) && write(dfd, (void *)buffer, cfg.data_size) < 0) { + if (!(opcode & 1) && write(dfd, (void *)buffer, buffer_size) < 0) { nvme_show_error("write: %s: failed to write buffer to output file", strerror(errno)); err = -EINVAL; -- 2.50.1