Received: from list by lists.gnu.org with archive (Exim 4.71) id 1erU5V-0000JS-5A for mharc-grub-devel@gnu.org; Thu, 01 Mar 2018 14:41:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erRYp-0001Yx-TE for grub-devel@gnu.org; Thu, 01 Mar 2018 12:00:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erRYm-0004NI-PC for grub-devel@gnu.org; Thu, 01 Mar 2018 12:00:04 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34699) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1erRYm-0004MO-IM for grub-devel@gnu.org; Thu, 01 Mar 2018 12:00:00 -0500 Received: by mail-wr0-f194.google.com with SMTP id m5so7316229wrg.1 for ; Thu, 01 Mar 2018 09:00:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KEtIEGHkcHTkhfBHE3GdTPC+YQSNM7ZF2F8httaKFSE=; b=Otlba3fiaN0fKoREN316EOlhxLX4Vq5y94A2QnaZM8+nYab/+wpIgrfBO4r2s+GXvb 5zgZHuzJ4VQeRViooEIyjgbXvCEW/orBvYDGmp2Mjf2KpdU/nlVK/BNQ9w+jtm0+vUzo FOG2lBnqsubnjg5k0HncbcrEhFntnbwOxHFweUl16Rl9bu09wgmsS46+d+f/deM73MZS J6y6d/eOFCyRqV29559N4bJWcbJMJccE9DK6NRF4MQU3FggS+c71l9JhHitRbcWYDUPP yeuAfvwH9juqMncxF1kyCDvZEb0qU3rlZtPApyeWLS1IgHqf4YArYzGXkBWWDnVzGfo4 VMrg== X-Gm-Message-State: APf1xPCEooWPEDCr4rr0A83l6cjS/FnEaHo7bEfJY9NdBz2tkAkYrimp w7ZUPVtmr9zaQh2yu9DixAnJvQ== X-Google-Smtp-Source: AG47ELvfEvIPdJBBBmEvfk9BpjY2cGDXf/hGnk5BlKKQxoQoP+DDL507xApUNTd2F22wrXo96ibwxQ== X-Received: by 10.223.157.205 with SMTP id q13mr2401099wre.266.1519923598818; Thu, 01 Mar 2018 08:59:58 -0800 (PST) Received: from Jamess-MacBook.local (global-184-7.nat-1.net.cam.ac.uk. [131.111.184.7]) by smtp.gmail.com with ESMTPSA id j42sm6274591wre.55.2018.03.01.08.59.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 08:59:57 -0800 (PST) Received: by Jamess-MacBook.local (Postfix, from userid 501) id 56558201369CB8; Thu, 1 Mar 2018 16:59:55 +0000 (GMT) Date: Thu, 1 Mar 2018 16:59:55 +0000 From: James Clarke To: John Paul Adrian Glaubitz , 891773@bugs.debian.org Cc: grub-devel@gnu.org, eric.snowberg@oracle.com Subject: Re: Bug#891773: [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty Message-ID: <20180301165955.GA3579@Jamess-MacBook.local> References: <20180301160028.13057-1-glaubitz@physik.fu-berlin.de> <151984246001.8316.8960051675655488899.reportbug@bagend.home.cknow.org> <20180301160028.13057-2-glaubitz@physik.fu-berlin.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180301160028.13057-2-glaubitz@physik.fu-berlin.de> User-Agent: Mutt/1.9.3 (2018-01-21) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.194 X-Mailman-Approved-At: Thu, 01 Mar 2018 14:41:55 -0500 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2018 17:00:13 -0000 On Thu, Mar 01, 2018 at 05:00:28PM +0100, John Paul Adrian Glaubitz wrote: > The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme > support within ofpath) introduced a functional regression: > > On systems which are not based on Open Firmware but have at > least one NVME device, find_obppath will return an empty path > and appending the disk name to of_path will therefore result > in a crash. Thus, when of_path is empty, just return the > disk name in of_path_of_nvme. > > Signed-off-by: John Paul Adrian Glaubitz > --- > grub-core/osdep/linux/ofpath.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c > index 1c30e7233..da0000f0f 100644 > --- a/grub-core/osdep/linux/ofpath.c > +++ b/grub-core/osdep/linux/ofpath.c > @@ -389,8 +389,13 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)), > } > > of_path = find_obppath (sysfs_path); > + > + if(of_path) > + strcat (of_path, disk); > + else > + of_path = strdup(disk); > + Whitespace issues aside, should it not be returning NULL if of_path is NULL, like the other users of find_obppath, such as of_path_of_scsi? This should restore the behaviour from before of_path_of_nvme was added, as grub_util_devname_to_ofpath would have previously returned NULL due to the unknown type? James > free (sysfs_path); > - strcat (of_path, disk); > return of_path; > } > > -- > 2.16.2