From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Mon, 23 Sep 2013 18:11:58 +0200 Subject: [U-Boot] [PATCH] Prevent a U-Boot crash on Wandboard In-Reply-To: <523F979C.1070205@gmail.com> References: <523F979C.1070205@gmail.com> Message-ID: <20130923181158.0c1747f5@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Steven, On Sun, 22 Sep 2013 21:21:32 -0400, Steven Falco wrote: > Prevent a crash when PXE boot calls do_bootm with a vmlinuz formatted image. > In this case, there will be a null cmdtp pointer, and we must not dereference > it. > > Signed-off-by: Steven A. Falco > > --- > > In file cmd_pxe.c around line 687 is a call: > > do_bootm(NULL, 0, bootm_argc, bootm_argv); > > Notice that the first argument is NULL. Therefore, the cmdtp > pointer will always be NULL when using the pxe boot mechanism. > > do_bootm() eventually calls boot_get_kernel(), still with cmdtp == NULL. > In the Wandboard case, the vmlinuz binary is not "legacy format", nor is > it "fit format", so U-Boot attempts to print: > > printf("Wrong Image Format for %s command\n", cmdtp->name); > > That is doomed to fail, because cmdtp is NULL. The following patch corrects > the problem; the command name will be printed only if the pointer is valid. Then shouldn't the patch subject/summary be "print command name only if cmdtp is not NULL" rather than the quite uninformative "prevent a crash"? Amicalement, -- Albert.