libkmod: assign values to variables to fix warnings
PATCH 1/1 libkmod: assign values to variables to fix warnings
Dear Lucas,
Thanks for your reply. I was wondering if these changes will
be merged in the future?
Best regards,
Shuo
Quoted 51 lines
gcc version 7.3.0 (GCC)
Quoted 49 lines
what compiler?
Quoted 48 lines
libkmod/libkmod.c: In function 'kmod_lookup_alias_is_builtin':./shared/util.h:73:9: warning: 'line' may be used uninitialized in this function [-Wmaybe-uninitialized]free(*(void**) p); ^~~~~~~~~~~~~~~~~ libkmod/libkmod.c:581:23: note: 'line' was declared here _cleanup_free_ char *line; ^~~~ In file included from libkmod/libkmod-module.c:42:0: libkmod/libkmod-module.c: In function 'kmod_module_probe_insert_module': ./shared/util.h:73:9: warning: 'cmd' may be used uninitialized in this function [-Wmaybe-uninitialized] free(*(void**) p); ^~~~~~~~~~~~~~~~~
libkmod/libkmod-module.c:1009:23: note: 'cmd' was declared here
_cleanup_free_ char *cmd;---
libkmod/libkmod-module.c| 2 +-libkmod/libkmod.c| 2 +-2 files changed, 2 insertions(+), 2 deletions(-)libkmod/libkmod-module.c +1
-1@@ -1006,7 +1006,7 @@ static int module_do_install_commands(struct kmod_module *mod, {const char *command =kmod_module_get_install_commands (mod);char *p; - _cleanup_free_ char *cmd; + _cleanup_free_ char *cmd = NULL;int err;size_t cmdlen, options_len, varlen;libkmod/libkmod.c +1
-1@@ -578,7 +578,7 @@ finish:bool kmod_lookup_alias_is_builtin (struct kmod_ctx *ctx,const char *name) { - _cleanup_free_ char *line; + _cleanup_free_ char *line = NULL; line =lookup_builtin_file (ctx, name);Signature · 1 line
2.23.0
Quoted 6 lines · Shuo Wang
Dear Lucas,
Thanks for your reply. I was wondering if these changes will
be merged in the future?
It seems those errors are actually compiler mistakes. Aren't there updates to the compiler? What distro is shipping gcc 7.3.0?? See below.
Quoted 46 lines
Best regards,
ShuoQuoted 42 lines
gcc version 7.3.0 (GCC)
Quoted 40 lines
what compiler?
Quoted 39 lines
libkmod/libkmod.c: In function 'kmod_lookup_alias_is_builtin':./shared/util.h:73:9: warning: 'line' may be used uninitialized in this function [-Wmaybe-uninitialized]free(*(void**) p); ^~~~~~~~~~~~~~~~~ libkmod/libkmod.c:581:23: note: 'line' was declared here _cleanup_free_ char *line; ^~~~ In file included from libkmod/libkmod-module.c:42:0: libkmod/libkmod-module.c: In function 'kmod_module_probe_insert_module': ./shared/util.h:73:9: warning: 'cmd' may be used uninitialized in this function [-Wmaybe-uninitialized] free(*(void**) p); ^~~~~~~~~~~~~~~~~
libkmod/libkmod-module.c:1009:23: note: 'cmd' was declared here
_cleanup_free_ char *cmd;---
libkmod/libkmod-module.c| 2 +-libkmod/libkmod.c| 2 +-2 files changed, 2 insertions(+), 2 deletions(-)libkmod/libkmod-module.c +1
-1@@ -1006,7 +1006,7 @@ static int module_do_install_commands(struct kmod_module *mod, {const char *command =kmod_module_get_install_commands (mod);char *p; - _cleanup_free_ char *cmd; + _cleanup_free_ char *cmd = NULL;int err;size_t cmdlen, options_len, varlen;libkmod/libkmod.c +0
-0@@ -578,7 +578,7 @@ finish:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
libkmod/libkmod.c finish: · line 583
Quoted 6 lines
libkmod/libkmod.c +1
-1bool kmod_lookup_alias_is_builtin (struct kmod_ctx *ctx,const char *name) { - _cleanup_free_ char *line; + _cleanup_free_ char *line = NULL; line =lookup_builtin_file (ctx, name);
line is declared above and just assigned here, the initial NULL makes no difference.
Lucas De Marchi
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
libkmod/libkmod.c +0
-1--2.23.0