From patchwork Tue Nov 21 20:15:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13463539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2D96C61D85 for ; Tue, 21 Nov 2023 20:26:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.638208.994548 (Exim 4.92) (envelope-from ) id 1r5XKW-00035k-9w; Tue, 21 Nov 2023 20:26:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 638208.994548; Tue, 21 Nov 2023 20:26:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XKW-00035d-7P; Tue, 21 Nov 2023 20:26:44 +0000 Received: by outflank-mailman (input) for mailman id 638208; Tue, 21 Nov 2023 20:26:43 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XA8-0006aW-D0 for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 20:16:00 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c8f4c279-88aa-11ee-98e1-6d05b1d4d9a1; Tue, 21 Nov 2023 21:15:59 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c8f4c279-88aa-11ee-98e1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700597759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=h72RGL0wBeTp69VGUdWNFI72/Va5/mOVad612sj0U0Y=; b=UXLJgQO4VsJYfcf8NLXV7gwqw3mFiLVsbWJHJqscvaRiuQNnpB3RK3lm gjNCQMBElgAI/sVfwOH4IJ05ZSMcWLUSiJvREotZcPaqNn4TRS0tP47kZ VEmwkTdiNCpvwBDnZaemk55ZsBLl7mnbm0HxMz8jTiJmX8AlRC3a5liAc 8=; X-CSE-ConnectionGUID: BxdPn14FSKGZsTscOECGPg== X-CSE-MsgGUID: KCcTuWliSAmd0KYlcd8jzQ== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127464604 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:2DIThqqwhsqCBxbA7XebtHi81kNeBmL+ZRIvgKrLsJaIsI4StFCzt garIBmFPPjbYDbxf4hzad6+8U0FupLTy9JgHVNvpCpmEiwb95uZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbOCYmYpA1Y8FE/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKq04G9wUmAWP6gR5waHzSBNVvrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXABodYiiF3r6Y+5GUePJQnc8EAeLEBIxK7xmMzRmBZRon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9dn0awTjLozO0zbbwVyGZxxsaUzRChZcumF K12TDR1+GMs+yfwhSZ7m/L45FXn9ek8ddNbfb8x/Q9G3HDihuMbI8kYr2asDU0p+3q0ksjjc XXyi1Qc/hb2jf+fnyRqRCo4hLn0zol9hbZuBalqEqmj8zlYTowT/Nbg4FUeAacy0dIhqA17I t7m0yYqr9eBlf4hyL/69LUEyhji0vcmwtorccjy1xZTY8UbvtwgOUkjTho+N9pJlOG1GhseN MecP301bJxbU6UanjfvC1KyNyoWnw1dy3tfnQ/ X-Talos-CUID: 9a23:cfEDrGssQNguq/RYovAvZDMy6IsPYnHlyi6MDXSbJlRydKaebnK715trxp8= X-Talos-MUID: 9a23:ZBJCTwhp+fBEYwUQ+LWh2sMpF+xj37mRDEE2uJAK4+q1MSd8azWPtWHi X-IronPort-AV: E=Sophos;i="6.04,216,1695700800"; d="scan'208";a="127464604" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Roberto Bagnara , Nicola Vetrini Subject: [PATCH v2 4/5] arm/efi: Simplify efi_arch_handle_cmdline() Date: Tue, 21 Nov 2023 20:15:39 +0000 Message-ID: <20231121201540.1528161-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231121201540.1528161-1-andrew.cooper3@citrix.com> References: <20231121201540.1528161-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 -Wwrite-strings is unhappy with assigning "xen" to a mutable pointer, but this logic looks incorrect. It was inherited from the x86 side, where the logic was redundant and has now been removed. In the ARM case it inserts the image name into "xen,xen-bootargs" and there is no logic at all to strip this before parsing it as the command line. The absence of any logic to strip an image name suggests that it shouldn't exist there, or having a Xen image named e.g. "hmp-unsafe" in the filesystem is going to lead to some unexpected behaviour on boot. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Luca Fancellu Tested-by: Luca Fancellu Reviewed-by: Stefano Stabellini Tested-by: Henry Wang Reviewed-by: Julien Grall --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Roberto Bagnara CC: Nicola Vetrini v2: * New. I'm afraid that all of this reasoning is based on reading the source code. I don't have any way to try this out in a real ARM UEFI environment. --- xen/arch/arm/efi/efi-boot.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 1c3640bb65fd..59d217667ff3 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -461,7 +461,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, union string name; char *buf; EFI_STATUS status; - int prop_len; + int prop_len = 0; int chosen; /* locate chosen node, which is where we add Xen module info. */ @@ -473,20 +473,6 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, if ( EFI_ERROR(status) ) PrintErrMesg(L"Unable to allocate string buffer", status); - if ( image_name ) - { - name.w = image_name; - w2s(&name); - } - else - name.s = "xen"; - - prop_len = 0; - prop_len += snprintf(buf + prop_len, - EFI_PAGE_SIZE - prop_len, "%s", name.s); - if ( prop_len >= EFI_PAGE_SIZE ) - blexit(L"FDT string overflow"); - if ( cfgfile_options ) { PrintMessage(L"Using bootargs from Xen configuration file.");