From: Luuk Paulussen Date: Mon, 16 May 2011 18:27:11 +0000 (+0000) Subject: sntp: avoid use of uninitialized variable X-Git-Tag: v2025.01-rc5-pxa1908~19394 X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=d6840e3d7abb71c2a45c3788dcc6edf7feb1d303;p=u-boot.git sntp: avoid use of uninitialized variable When we use the ntpserverip environment variable argv[1] may not be set. Printing the error message using the NetNtpServerIP variable ensures the correct output in both cases. Signed-off-by: Luuk Paulussen Acked-by: Chris Packham Cc: Ben Warren Acked-by: Detlev Zundel --- diff --git a/common/cmd_net.c b/common/cmd_net.c index b2c9355a21..75ba1c3cdc 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -341,7 +341,8 @@ int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) else NetTimeOffset = simple_strtol (toff, NULL, 10); if (NetLoop(SNTP) < 0) { - printf("SNTP failed: host %s not responding\n", argv[1]); + printf("SNTP failed: host %pI4 not responding\n", + &NetNtpServerIP); return 1; }