Message ID | 1402304522-31094-1-git-send-email-jeroen@myspectrum.nl |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
On Mon, Jun 09, 2014 at 11:02:02AM +0200, Jeroen Hofstee wrote: > 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> Applied to u-boot/master, thanks!
diff --git a/common/hash.c b/common/hash.c index 7627b84..040eead 100644 --- a/common/hash.c +++ b/common/hash.c @@ -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;
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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)