[PATCH 2/2] passwd: avoid NULL ptr usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux