From owner-svn-src-all@FreeBSD.ORG Wed Apr 1 10:02:30 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F1CB4FDE; Wed, 1 Apr 2015 10:02:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC72520E; Wed, 1 Apr 2015 10:02:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t31A2TF0085679; Wed, 1 Apr 2015 10:02:29 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t31A2TrN085678; Wed, 1 Apr 2015 10:02:29 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201504011002.t31A2TrN085678@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 1 Apr 2015 10:02:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280953 - head/sys/boot/i386/libi386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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: Wed, 01 Apr 2015 10:02:30 -0000 Author: royger Date: Wed Apr 1 10:02:28 2015 New Revision: 280953 URL: https://svnweb.freebsd.org/changeset/base/280953 Log: multiboot: zero mod list array Zero the list of modules array before using it, or else we might pass uninitialized data in unused fields of the struct that will make Xen choke. Also add a check to make sure malloc succeeds. Sponsored by: Citrix Systems R&D Modified: head/sys/boot/i386/libi386/multiboot.c Modified: head/sys/boot/i386/libi386/multiboot.c ============================================================================== --- head/sys/boot/i386/libi386/multiboot.c Wed Apr 1 08:37:50 2015 (r280952) +++ head/sys/boot/i386/libi386/multiboot.c Wed Apr 1 10:02:28 2015 (r280953) @@ -274,7 +274,14 @@ multiboot_exec(struct preloaded_file *fp error = EFTYPE; goto error; } + mb_mod = malloc(sizeof(struct multiboot_mod_list) * NUM_MODULES); + if (mb_mod == NULL) { + error = ENOMEM; + goto error; + } + + bzero(mb_mod, sizeof(struct multiboot_mod_list) * NUM_MODULES); /* * Calculate how much memory is needed for the metatdata. We did