common: hash: zero end the string instead of the pointer
authorJeroen Hofstee <jeroen@myspectrum.nl>
Mon, 9 Jun 2014 09:02:02 +0000 (11:02 +0200)
committerTom Rini <trini@ti.com>
Wed, 11 Jun 2014 20:27:05 +0000 (16:27 -0400)
if algo->digest_size is zero nothing is set in the str_output
buffer. An attempt is made to zero end the buffer, but the
pointer to the buffer is set to zero instead. I am unaware if
it causes any actual problems, but solves the following warning:

common/hash.c:217:13: warning: expression which evaluates to zero treated as
a null pointer constant of type 'char *' [-Wnon-literal-null-conversion]
                str_ptr = '\0';
                          ^~~~

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
common/hash.c

index 41a4a28437770fc4aad7893e56339dee11e9e546..237bd04bb12e67fe95542b9068a5ef2eb12a4a3c 100644 (file)
@@ -214,7 +214,7 @@ static void store_result(struct hash_algo *algo, const u8 *sum,
                        sprintf(str_ptr, "%02x", sum[i]);
                        str_ptr += 2;
                }
-               str_ptr = '\0';
+               *str_ptr = '\0';
                setenv(dest, str_output);
        } else {
                ulong addr;