]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
tree: use strtou32 to read lba_size
authorDaniel Wagner <dwagner@suse.de>
Tue, 30 Apr 2024 14:53:49 +0000 (16:53 +0200)
committerDaniel Wagner <wagi@monom.org>
Tue, 30 Apr 2024 14:59:35 +0000 (16:59 +0200)
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>
src/nvme/tree.c

index 2218d5a8145b5a2c57856856c1803a47e6d67f9c..eb9486dec251334a78ec82edc045958f5aa1c8a8 100644 (file)
@@ -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" }