All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH 7/7] ndctl: fix unchecked return value
Date: Mon, 25 Apr 2016 12:50:26 -0700	[thread overview]
Message-ID: <146161382607.21779.2208336715925326189.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <146161378966.21779.1219526957524644729.stgit@dwillia2-desk3.amr.corp.intel.com>

Static analysis flags the sscanf() in get_system_kver() for return-value
checking. Fall back to the system kernel headers version.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/core.c b/test/core.c
index dba9c4c38ab1..b5703273fa76 100644
--- a/test/core.c
+++ b/test/core.c
@@ -19,7 +19,8 @@ static unsigned int get_system_kver(void)
 
 	uname(&utsname);
 
-	sscanf(utsname.release, "%d.%d.%d", &a, &b, &c);
+	if (sscanf(utsname.release, "%d.%d.%d", &a, &b, &c) != 3)
+		return LINUX_VERSION_CODE;
 
 	return KERNEL_VERSION(a,b,c);
 }

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

      parent reply	other threads:[~2016-04-25 19:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25 19:49 [ndctl PATCH 0/7] miscellaneous fixes Dan Williams
2016-04-25 19:49 ` [ndctl PATCH 1/7] ndctl, create-namespace: report failures due to namespace being mounted Dan Williams
2016-04-25 19:49 ` [ndctl PATCH 2/7] ndctl, create-namespace: check for ZONE_DEVICE=n kernels Dan Williams
2016-04-25 19:50 ` [ndctl PATCH 3/7] ndctl: fix some warnings Dan Williams
2016-04-25 19:50 ` [ndctl PATCH 4/7] ndctl: drop asciidocs and xmlto requirement for --disable-docs Dan Williams
2016-04-25 19:50 ` [ndctl PATCH 5/7] ndctl: fix to_dsm_index() static analysis warning Dan Williams
2016-04-26 18:10   ` Dan Williams
2016-04-25 19:50 ` [ndctl PATCH 6/7] ndctl: fix uninitialized variable in add_dimm() Dan Williams
2016-04-25 19:50 ` Dan Williams [this message]

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=146161382607.21779.2208336715925326189.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.