[PATCH 2/2] passwd: avoid NULL ptr usage
Lucas Stach
l.stach at pengutronix.de
Wed Sep 9 01:38:06 PDT 2015
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 at 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
More information about the barebox
mailing list