linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shuo Wang <wangshuo47@huawei.com>
To: <lucas.de.marchi@gmail.com>, <patchwork-bot@kernel.org>,
	<linux-modules@vger.kernel.org>
Cc: <hushiyuan@huawei.com>
Subject: [PATCH] libkmod: assign values to variables to fix warnings
Date: Fri, 8 Jan 2021 15:22:43 +0800	[thread overview]
Message-ID: <20210108072243.22828-1-wangshuo47@huawei.com> (raw)

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(-)

diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 76a6dc3..2e973b5 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -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;
 
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 43423d6..66e658c 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -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);
 
-- 
2.23.0


             reply	other threads:[~2021-01-08  7:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08  7:22 Shuo Wang [this message]
2021-01-11 13:09 ` Lucas De Marchi
2021-01-11 14:13 Shuo Wang
2021-01-21  7:06 Shuo Wang
2021-01-23 19:04 ` Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210108072243.22828-1-wangshuo47@huawei.com \
    --to=wangshuo47@huawei.com \
    --cc=hushiyuan@huawei.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=patchwork-bot@kernel.org \
    --subject='Re: [PATCH] libkmod: assign values to variables to fix warnings' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).