Skip to content

Conversation

@martin-gpy
Copy link
Contributor

Valgrind revealed multiple errors during a nvme connect-all while using the JSON config file. Fix the same.

Valgrind complained about a conditional jump or move depending on
an uninitialized value created by a stack allocation at
_nvmf_discovery():

==16682== Conditional jump or move depends on uninitialised value(s)
==16682==    at 0x4879DA5: _nvmf_discovery (fabrics.c:2198)
==16682==    by 0x487B341: _discovery_config_json (fabrics.c:2424)
==16682==    by 0x487B549: nvmf_discovery_config_json (fabrics.c:2461)
==16682==    by 0x409A70: fabrics_discovery (fabrics.c:569)
==16682==    by 0x446358: handle_plugin (plugin.c:190)
==16682==    by 0x407760: main (nvme.c:11029)
==16682==  Uninitialised value was created by a stack allocation
==16682==    at 0x4879AF2: _nvmf_discovery (fabrics.c:2102)

Fix the same.

Signed-off-by: Martin George <marting@netapp.com>
Valgrind revealed a mem leak caused due to not invoking
parser_cleanup for the corresponding parser_init at
nvmf_discovery_config_file():

==16682== 256 bytes in 1 blocks are definitely lost in loss record 1 of 2
==16682==    at 0x4848C31: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16682==    by 0x40881A: cb_parser_init (fabrics.c:254)
==16682==    by 0x487B8A2: nvmf_discovery_config_file (fabrics.c:2554)
==16682==    by 0x4099F6: fabrics_discovery (fabrics.c:574)
==16682==    by 0x446358: handle_plugin (plugin.c:190)
==16682==    by 0x407760: main (nvme.c:11029)
==16682==
==16682== 472 bytes in 1 blocks are still reachable in loss record 2 of 2
==16682==    at 0x4841984: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16682==    by 0x494C7CA: __fopen_internal (in /lib64/libc.so.6)
==16682==    by 0x408802: cb_parser_init (fabrics.c:248)
==16682==    by 0x487B8A2: nvmf_discovery_config_file (fabrics.c:2554)
==16682==    by 0x4099F6: fabrics_discovery (fabrics.c:574)
==16682==    by 0x446358: handle_plugin (plugin.c:190)
==16682==    by 0x407760: main (nvme.c:11029)

Fix the same.

Signed-off-by: Martin George <marting@netapp.com>
@igaw
Copy link
Collaborator

igaw commented Jan 5, 2026

Nice! Thanks a lot!

@igaw igaw merged commit 5159e08 into linux-nvme:master Jan 5, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants