From owner-svn-src-head@freebsd.org Fri Dec 18 05:53:39 2015 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 D3D59A4B8F4; Fri, 18 Dec 2015 05:53:39 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x232.google.com (mail-pa0-x232.google.com [IPv6:2607:f8b0:400e:c03::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA89E1D27; Fri, 18 Dec 2015 05:53:39 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x232.google.com with SMTP id jx14so26065609pad.2; Thu, 17 Dec 2015 21:53:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=UEC9XHjFPNi9zK7wJt9KaLR7MZhfue+m3lGTp5CjChw=; b=wUKZi4RKKprs1ZV1eDF0/gYAUZ2kHn0joaXjCxUng9U9rx0jS5vV+6Jf5omz6lmNwK KS2wpTpy69bFrp7hEVXWqXV38miDRHyYwd7fbmL49CfqTfwZBYj5t6NOu5FV1UTpFoVx Z8vhUWtljNj5oQjqYKdMa9tqbh9EknO2aSHxtlIieUFuQaMqDrtbYUJESpS9iUm3QCqx uIerkkRp8L7FtzGfgQqvuWyWivG0UZb99+h8FIlCpki/iheD3MvdEjXqJwl+lXPgH33R nEBnnhDj2tp5hmRB+OX7eHUA/arlZq0t3t43brjgTSv/F27RF8R6uY63DguMaZOGQhdn 2tSw== X-Received: by 10.66.158.129 with SMTP id wu1mr2583007pab.146.1450418019234; Thu, 17 Dec 2015 21:53:39 -0800 (PST) Received: from [100.193.155.241] ([172.56.42.96]) by smtp.gmail.com with ESMTPSA id e67sm14989027pfj.53.2015.12.17.21.53.37 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Dec 2015 21:53:38 -0800 (PST) Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r292410 - head/usr.sbin/boot0cfg From: Garrett Cooper X-Mailer: iPhone Mail (13C75) In-Reply-To: Date: Thu, 17 Dec 2015 21:53:36 -0800 Cc: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <30CD0290-06B9-4024-8EEE-F25090608D46@gmail.com> References: <201512172042.tBHKg5bM091931@repo.freebsd.org> To: luke Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 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, 18 Dec 2015 05:53:39 -0000 > On Dec 17, 2015, at 21:36, luke wrote: >=20 >> On Fri, Dec 18, 2015 at 4:42 AM, John Baldwin wrote: >> Author: jhb >> Date: Thu Dec 17 20:42:05 2015 >> New Revision: 292410 >> URL: https://svnweb.freebsd.org/changeset/base/292410 >>=20 >> Log: >> Exit cleanly if malloc() fails to allocate a buffer for a copy of the >> current MBR. >>=20 >> PR: 205322 >> Submitted by: Alexander Kuleshov >> MFC after: 1 week >>=20 >> Modified: >> head/usr.sbin/boot0cfg/boot0cfg.c >>=20 >> Modified: head/usr.sbin/boot0cfg/boot0cfg.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D >> --- head/usr.sbin/boot0cfg/boot0cfg.c Thu Dec 17 20:33:20 2015 (= r292409) >> +++ head/usr.sbin/boot0cfg/boot0cfg.c Thu Dec 17 20:42:05 2015 (= r292410) >> @@ -337,6 +337,8 @@ read_mbr(const char *disk, u_int8_t **mb >> return (mbr_size); >> } >> *mbr =3D malloc(sizeof(buf)); >> + if (mbr =3D=3D NULL) >> + errx(1, "%s: unable to allocate MBR buffer", disk); >> memcpy(*mbr, buf, sizeof(buf)); >> close(fd); > Hi,=20 >=20 > Should the check be against *mbr ? > + if (*mbr =3D=3D NULL) > + errx(1, "%s: unable to allocate MBR buffer", disk); Yup!=