mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] passwd: avoid NULL ptr usage
Date: Wed,  9 Sep 2015 10:38:06 +0200	[thread overview]
Message-ID: <1441787886-10673-2-git-send-email-l.stach@pengutronix.de> (raw)
In-Reply-To: <1441787886-10673-1-git-send-email-l.stach@pengutronix.de>

Fixes
common/password.c: In function 'check_passwd':
common/password.c:292:4: warning: reading through null pointer (argument 3)
    pr_err("No such digest: %s\n", PASSWD_SUM);

if no algo is enabled in which case PASSWD_SUM is defined to NULL.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 common/password.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/password.c b/common/password.c
index 43c5e0cc0e08..b5b7655a6435 100644
--- a/common/password.c
+++ b/common/password.c
@@ -289,7 +289,8 @@ static int check_passwd(unsigned char *passwd, size_t length)
 	} else {
 		d = digest_alloc(PASSWD_SUM);
 		if (!d) {
-			pr_err("No such digest: %s\n", PASSWD_SUM);
+			pr_err("No such digest: %s\n",
+			       PASSWD_SUM ? PASSWD_SUM : "NULL");
 			return -ENOENT;
 		}
 
-- 
2.5.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-09-09  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-09  8:38 [PATCH 1/2] ARM: add implementation for dma_alloc_writecombine for !CONFIG_MMU Lucas Stach
2015-09-09  8:38 ` Lucas Stach [this message]
2015-09-14  6:00 ` Sascha Hauer

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=1441787886-10673-2-git-send-email-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.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