summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2015-09-09 10:38:06 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-09-14 07:59:11 +0200
commit342891feed84ac59ee1fc86b9d75a44c923f2f79 (patch)
tree62c4f0b63f0552f3573c02bf5c577d669fa711e4 /common
parent15c41beb5b7ad103db137c2e8786d28a46cbb818 (diff)
downloadbarebox-342891feed84ac59ee1fc86b9d75a44c923f2f79.tar.gz
passwd: avoid NULL ptr usage
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/password.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/password.c b/common/password.c
index 43c5e0c..b5b7655 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;
}