From owner-svn-src-head@freebsd.org Fri Nov 10 22:37:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A87A1E52AEB; Fri, 10 Nov 2017 22:37:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CC7966705; Fri, 10 Nov 2017 22:37:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 0745E10A8BA; Fri, 10 Nov 2017 17:37:02 -0500 (EST) From: John Baldwin To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r325681 - head/sys/boot/efi/boot1 Date: Fri, 10 Nov 2017 14:23:23 -0800 Message-ID: <1873424.jIhDDOsQTz@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201711102126.vAALQi7w009910@repo.freebsd.org> References: <201711102126.vAALQi7w009910@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 10 Nov 2017 17:37:02 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 22:37:03 -0000 On Friday, November 10, 2017 09:26:44 PM Ed Maste wrote: > Author: emaste > Date: Fri Nov 10 21:26:44 2017 > New Revision: 325681 > URL: https://svnweb.freebsd.org/changeset/base/325681 > > Log: > boot1: avoid using NULL device path > > As of r323063 boot1 printed out the path & device from which it was > loaded, but uboot's EFI implementation lacked some support, resulting in > a NULL pointer and a crash. Check for a NULL pointer and avoid > reporting (and storing in the environment) the device and path in this > case. > > Submitted by: Zakary Nafziger > MFC after: 1 week > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D13038 > > Modified: > head/sys/boot/efi/boot1/boot1.c > > Modified: head/sys/boot/efi/boot1/boot1.c > ============================================================================== > --- head/sys/boot/efi/boot1/boot1.c Fri Nov 10 20:30:10 2017 (r325680) > +++ head/sys/boot/efi/boot1/boot1.c Fri Nov 10 21:26:44 2017 (r325681) > @@ -460,22 +460,23 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) > imgpath = NULL; > if (status == EFI_SUCCESS) { > text = efi_devpath_name(img->FilePath); > - printf(" Load Path: %S\n", text); > - efi_setenv_freebsd_wcs("Boot1Path", text); > - efi_free_devpath_name(text); > - > - status = BS->HandleProtocol(img->DeviceHandle, &DevicePathGUID, > - (void **)&imgpath); > - if (status != EFI_SUCCESS) { > - DPRINTF("Failed to get image DevicePath (%lu)\n", > - EFI_ERROR_CODE(status)); > - } else { > - text = efi_devpath_name(imgpath); > - printf(" Load Device: %S\n", text); > - efi_setenv_freebsd_wcs("Boot1Dev", text); > + if (text != NULL) { > + printf(" Load Path: %S\n", text); > + efi_setenv_freebsd_wcs("Boot1Path", text); > efi_free_devpath_name(text); > - } > > + status = BS->HandleProtocol(img->DeviceHandle, > + &DevicePathGUID, (void **)&imgpath); > + if (status != EFI_SUCCESS) { > + DPRINTF("Failed to get image DevicePath (%lu)\n", > + EFI_ERROR_CODE(status)); > + } else { > + text = efi_devpath_name(imgpath); Shouldn't you check this for NULL as well then? -- John Baldwin