From: Vishal Verma <vishal.l.verma@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH 1/3] ndctl, inject-smart: cleanup uninitialized variable warnings
Date: Wed, 21 Feb 2018 16:02:50 -0700 [thread overview]
Message-ID: <20180221230252.16632-2-vishal.l.verma@intel.com> (raw)
In-Reply-To: <20180221230252.16632-1-vishal.l.verma@intel.com>
There were a couple of cases where we could try to unref a command that
had never been initialized. Fix those by always initializing the cmd
pointers to NULL.
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
ndctl/inject-smart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ndctl/inject-smart.c b/ndctl/inject-smart.c
index 02f8b0e..45dbc8d 100644
--- a/ndctl/inject-smart.c
+++ b/ndctl/inject-smart.c
@@ -221,7 +221,7 @@ static int smart_init(void)
static int smart_set_thresh(struct ndctl_dimm *dimm)
{
const char *name = ndctl_dimm_get_devname(dimm);
- struct ndctl_cmd *st_cmd, *sst_cmd;
+ struct ndctl_cmd *st_cmd = NULL, *sst_cmd = NULL;
int rc = -EOPNOTSUPP;
st_cmd = ndctl_dimm_cmd_new_smart_threshold(dimm);
@@ -332,7 +332,7 @@ out:
static int smart_inject(struct ndctl_dimm *dimm)
{
const char *name = ndctl_dimm_get_devname(dimm);
- struct ndctl_cmd *si_cmd;
+ struct ndctl_cmd *si_cmd = NULL;
int rc = -EOPNOTSUPP;
send_inject_val(media_temperature)
--
2.14.3
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next prev parent reply other threads:[~2018-02-21 22:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 23:02 [ndctl PATCH 0/3] add -Wmaybe-uninitialized Vishal Verma
2018-02-21 23:02 ` Vishal Verma [this message]
2018-02-21 23:02 ` [ndctl PATCH 2/3] ndctl, update: fix uninitialized variable warnings Vishal Verma
2018-02-21 23:02 ` [ndctl PATCH 3/3] ndctl, update: remove the check for !cmd when dereferencing it Vishal Verma
2018-02-21 23:06 ` [ndctl PATCH 4/3] ndctl, configure: add -Wmaybe-uninitialized to cflags Vishal Verma
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=20180221230252.16632-2-vishal.l.verma@intel.com \
--to=vishal.l.verma@intel.com \
--cc=linux-nvdimm@lists.01.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).