Skip to content

Commit

Permalink
tree: use strout32 to read lba_size
Browse files Browse the repository at this point in the history
The lba_size variable is of type int, thus we should use nvme_strtou32
and avoid overwriting memory.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
  • Loading branch information
igaw committed Apr 30, 2024
1 parent 2ba04fe commit 851d47e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvme/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2455,7 +2455,7 @@ static int nvme_ns_init(const char *path, struct nvme_ns *ns)
struct sysfs_attr_table base[] = {
{ &ns->nsid, nvme_strtou32, true, "nsid" },
{ &size, nvme_strtou64, true, "size" },
{ &ns->lba_size, nvme_strtou64, true, "queue/logical_block_size" },
{ &ns->lba_size, nvme_strtou32, true, "queue/logical_block_size" },
{ ns->eui64, nvme_strtoeuid, false, "eui" },
{ ns->nguid, nvme_strtouuid, false, "nguid" },
{ ns->uuid, nvme_strtouuid, false, "uuid" }
Expand Down

0 comments on commit 851d47e

Please sign in to comment.