Skip to content

Commit

Permalink
nvme: Reduce get-reg command memory allocation size
Browse files Browse the repository at this point in the history
Reduce the size to the register offset to get.

Signed-off-by: Tokunori Ikegami <[email protected]>
  • Loading branch information
ikegami-t committed Feb 4, 2024
1 parent de5ccae commit 18118fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -5410,7 +5410,8 @@ bool nvme_is_fabrics_reg(int offset)

static int get_register_property(int fd, void **pbar, int offset)
{
int err, size = getpagesize();
int err;
int size = offset + 1 + nvme_is_64bit_reg(offset) ? sizeof(uint64_t) : sizeof(uint32_t);
__u64 value;
void *bar = malloc(size);
struct nvme_get_property_args args = {
Expand Down

0 comments on commit 18118fd

Please sign in to comment.