From owner-svn-src-all@FreeBSD.ORG Sat Feb 26 12:04:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BFB3106566C; Sat, 26 Feb 2011 12:04:35 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 107AE8FC19; Sat, 26 Feb 2011 12:04:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1QC4YN6070634; Sat, 26 Feb 2011 12:04:34 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1QC4Y7e070631; Sat, 26 Feb 2011 12:04:34 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201102261204.p1QC4Y7e070631@svn.freebsd.org> From: Bruce Cran Date: Sat, 26 Feb 2011 12:04:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219053 - in stable/8/sys/boot: common efi/libefi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Feb 2011 12:04:35 -0000 Author: brucec Date: Sat Feb 26 12:04:34 2011 New Revision: 219053 URL: http://svn.freebsd.org/changeset/base/219053 Log: MFC r218974: Handle memory allocation failures in include(). Fix a format specifier in libefi: status is an unsigned int, not unsigned long. PR: i386/85652 Submitted by: Ben Thomas Modified: stable/8/sys/boot/common/interp.c stable/8/sys/boot/efi/libefi/efipart.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/common/interp.c ============================================================================== --- stable/8/sys/boot/common/interp.c Sat Feb 26 11:52:34 2011 (r219052) +++ stable/8/sys/boot/common/interp.c Sat Feb 26 12:04:34 2011 (r219053) @@ -246,6 +246,17 @@ include(const char *filename) if (*cp == '\0') continue; /* ignore empty line, save memory */ sp = malloc(sizeof(struct includeline) + strlen(cp) + 1); + /* On malloc failure (it happens!), free as much as possible and exit */ + if (sp == NULL) { + while (script != NULL) { + se = script; + script = script->next; + free(se); + } + sprintf(command_errbuf, "file '%s' line %d: memory allocation " + "failure - aborting\n", filename, line); + return (CMD_ERROR); + } strcpy(sp->text, cp); #ifndef BOOT_FORTH sp->flags = flags; Modified: stable/8/sys/boot/efi/libefi/efipart.c ============================================================================== --- stable/8/sys/boot/efi/libefi/efipart.c Sat Feb 26 11:52:34 2011 (r219052) +++ stable/8/sys/boot/efi/libefi/efipart.c Sat Feb 26 12:04:34 2011 (r219053) @@ -203,7 +203,7 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, i } if (EFI_ERROR(status)) - printf("%s: rw=%d, status=%lu\n", __func__, rw, status); + printf("%s: rw=%d, status=%u\n", __func__, rw, status); return (efi_status_to_errno(status)); }