From nobody Mon Feb 9 22:05:22 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580517221728460.4394106475397; Fri, 31 Jan 2020 16:33:41 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixgim-00068c-Kv; Sat, 01 Feb 2020 00:33:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixgil-00068C-2j for xen-devel@lists.xenproject.org; Sat, 01 Feb 2020 00:33:11 +0000 Received: from bombadil.infradead.org (unknown [2607:7c80:54:e::133]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 690f4b7c-448a-11ea-8396-bc764e2007e4; Sat, 01 Feb 2020 00:33:05 +0000 (UTC) Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ixgie-0007N3-Gv; Sat, 01 Feb 2020 00:33:04 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1ixgid-009ulL-A1; Sat, 01 Feb 2020 00:33:03 +0000 X-Inumbo-ID: 690f4b7c-448a-11ea-8396-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=sNt82ToGZTbiQmLWphlDTKMwMKPPJsJCzyiuyVo3of4=; b=XPXbANAX5EkzvwMZXCL6YQWqFT UwQKHjnRbQhYzz6TzL6iT0FomQOYie7PrhlRwEXQgbact2p8ZGcEgQkYCs/N5xYTsmYqhvgO8Rwyv eSJsPqMPk3KPFzrtZXaGj3OdYv0VWMjWCxj4zZc2ogY6SKoXFXIGlUQSE6tC+TpbjJxSuDHG+RgHA OQdifP35PbU4h2PPR+YfFvLf5v9WlVm5Ru4FBmy9aHDIaokHQnvl8wyVl7njv1x5iCeOSxEIp/jBP hk9d7gJ5IJbAelDhRX28AKMMSky6GUm5JLfUqhpXZel7dFWLLiRd0PSBTdXEahVfxFDeL9kPGnNAn QKOfB3iQ==; From: David Woodhouse To: xen-devel@lists.xenproject.org Date: Sat, 1 Feb 2020 00:33:02 +0000 Message-Id: <20200201003303.2363081-7-dwmw2@infradead.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <8a95f787ca93b23ee8d8c0b55fcc63d22a75c5f3.camel@infradead.org> References: <8a95f787ca93b23ee8d8c0b55fcc63d22a75c5f3.camel@infradead.org> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Subject: [Xen-devel] [PATCH 7/8] x86/setup: simplify handling of initrdidx when no initrd present X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Varad Gautam , Ian Jackson , Hongyan Xia , Paul Durrant , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: David Woodhouse Remove a ternary operator that made my brain hurt. Replace it with something simpler that makes it somewhat clearer that the check for initrdidx < mbi->mods_count is because mbi->mods_count is what find_first_bit() will return when it doesn't find anything. Signed-off-by: David Woodhouse Acked-by: Julien Grall --- xen/arch/x86/setup.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 5f68a1308f..10209e6bfb 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -687,7 +687,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) char *cmdline, *kextra, *loader; unsigned int initrdidx, num_parked =3D 0; multiboot_info_t *mbi; - module_t *mod; + module_t *mod, *initrd =3D NULL; unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1]; int i, j, e820_warn =3D 0, bytes =3D 0; bool acpi_boot_table_init_done =3D false, relocated =3D false; @@ -1793,6 +1793,9 @@ void __init noreturn __start_xen(unsigned long mbi_p) xen_processor_pmbits |=3D XEN_PROCESSOR_PM_CX; =20 initrdidx =3D find_first_bit(module_map, mbi->mods_count); + if ( initrdidx < mbi->mods_count ) + initrd =3D mod + initrdidx; + if ( bitmap_weight(module_map, mbi->mods_count) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", @@ -1817,9 +1820,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) * We're going to setup domain0 using the module(s) that we stashed sa= fely * above our heap. The second module, if present, is an initrd ramdisk. */ - if ( construct_dom0(dom0, mod, modules_headroom, - (initrdidx > 0) && (initrdidx < mbi->mods_count) - ? mod + initrdidx : NULL, cmdline) !=3D 0) + if ( construct_dom0(dom0, mod, modules_headroom, initrd, cmdline) !=3D= 0 ) panic("Could not set up DOM0 guest OS\n"); =20 if ( cpu_has_smap ) --=20 2.21.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel