From patchwork Mon Nov 20 22:49:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13462230 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 7D595C5AE5B for ; Mon, 20 Nov 2023 22:49:52 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637327.993072 (Exim 4.92) (envelope-from ) id 1r5D59-0005vN-CD; Mon, 20 Nov 2023 22:49:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637327.993072; Mon, 20 Nov 2023 22:49:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D59-0005vD-8I; Mon, 20 Nov 2023 22:49:31 +0000 Received: by outflank-mailman (input) for mailman id 637327; Mon, 20 Nov 2023 22:49:29 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D57-0005pp-BF for xen-devel@lists.xenproject.org; Mon, 20 Nov 2023 22:49:29 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0cdfd9a8-87f7-11ee-9b0e-b553b5be7939; Mon, 20 Nov 2023 23:49:26 +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: 0cdfd9a8-87f7-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700520566; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fXKH+lmodmLPygRsUw8ADaKchTw1j5k6JR9llmINrLo=; b=XhzxsYNbETJpZqQHJyRyLACtcZ0P7u4YMUVE7MSv0peB4hAmu0IEUuu5 RVa5Zmf6LbM6/BUkmPKDj7Y/qh0UsKgMPXK06rzGrXdxS774qmjawUZaQ CAshBu6EsepUIhGZWEpZFL6WCbAc/vrCuQ87l1HPSVKaVvY7gxw4eEsdD w=; X-CSE-ConnectionGUID: LtYo8xJLRvC+jqiF6E23hw== X-CSE-MsgGUID: bUpW3/HoQGi4hHSN83IxsA== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127436304 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:NRCWsKPWwwIoxHjvrR2ll8FynXyQoLVcMsEvi/4bfWQNrUpx0jAHm 2AcUDzXafaNN2LyLttzbduy8BkA75LXx9ZjSwto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CQ6jefQAOOkVIYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGjxSs/7rRC9H5qyo42pB5ARmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0sJrMGYe5 d48Ei4mLRKahszo7ejgSvY506zPLOGzVG8eknRpzDWfBvc6W5HTBa7N4Le03h9p2JoIR6yHI ZNEOHwwNHwsYDUWUrsTILs4kP2lmT/UdDpApUjOjaE2/3LS3Ep6172F3N/9I4bVGZ4LxR7Ez o7A127EGi5Bc/yY8BWErnKMvcmfxgLrQ6tHQdVU8dY12QbOlwT/EiY+RVa95PW0lEO6c9ZeM FAPvDojq7Ao806mRcW7WAe3yFamlBMBX9tbE8Uh9RqAjKHT5m6xGWwsXjNHLts8u6ceQz0h0 VuA2c3kGSZutry9Q2+S7bqSonW5Pi19BXUFbyIeUQxD6dDspogphzrFU9l4Hai6yNbyHFnNL yui9XZkwe9J1IhSivT9ogivby+QSobhahIE4VXHfEaf8Cg6ZpekSdKFswPb8qMVRGqGdWVtr EToiuDHs7hWUcDTznXTKNjhCo1F8BpsDdE9vbKMN8N4n9hV0yT/Fb28GRknTKuTDu4KeCXyf GjYsh5L6ZlYMROCNPAvO9/pVp52lPG/S7wJs8w4iPIUOvCdkyfdpElTibO4hTixwCDAb4ljU XtkTSpcJSlDUvk2pNZHb+wczaUq1kgDKZD7HPjGI+Cc+ePGPha9EO5VWGZim8hltMtoVi2Jq YcAXyZLoj0DONDDjt7/qN9PdA1SdCBkVPgbaaV/L4a+H+avI0l5Y9e5/F/rU9UNc3h9/gsQw kyAZw== IronPort-HdrOrdr: A9a23:/82i1aPMKG9BnsBcTvmjsMiBIKoaSvp037Eqv3oedfUzSL3gqy nOpoV86faaslYssR0b9exofZPwJE80lqQFhrX5X43SPzUO0VHAROoJgLcKgQeQfxEWntQtrZ uIGJIeNDSfNzdHZL7BkWuFL+o= X-Talos-CUID: 9a23:4OQ3wW7pNSFkW19Rmtss0FIlHZA1UFnn0lyTIVa5JzhEEuaVVgrF X-Talos-MUID: 9a23:fvtYYQWPqreOFqPq/DXRnA45c+dv2ouvVEAtqrNW4OiULgUlbg== X-IronPort-AV: E=Sophos;i="6.04,214,1695700800"; d="scan'208";a="127436304" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Nicola Vetrini , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Roberto Bagnara Subject: [PATCH 1/6] x86/setup: Make the loader variable const Date: Mon, 20 Nov 2023 22:49:07 +0000 Message-ID: <20231120224912.1421916-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231120224912.1421916-1-andrew.cooper3@citrix.com> References: <20231120224912.1421916-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 It is never written to, but has a string literal assigned, and needs to be const to support -Wwrite-strings Suggested-by: Nicola Vetrini Signed-off-by: Andrew Cooper Reviewed-by: Stefano Stabellini Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Roberto Bagnara CC: Nicola Vetrini --- xen/arch/x86/setup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index a3d3f797bb1e..c41dfdb2bdf8 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -971,8 +971,8 @@ static struct domain *__init create_dom0(const module_t *image, /* SAF-1-safe */ void __init noreturn __start_xen(unsigned long mbi_p) { - const char *memmap_type = NULL; - char *cmdline, *kextra, *loader; + const char *memmap_type = NULL, *loader; + char *cmdline, *kextra; void *bsp_stack; struct cpu_info *info = get_cpu_info(), *bsp_info; unsigned int initrdidx, num_parked = 0; @@ -1023,8 +1023,8 @@ void __init noreturn __start_xen(unsigned long mbi_p) mod = __va(mbi->mods_addr); } - loader = (mbi->flags & MBI_LOADERNAME) - ? (char *)__va(mbi->boot_loader_name) : "unknown"; + loader = (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_name) + : "unknown"; /* Parse the command-line options. */ cmdline = cmdline_cook((mbi->flags & MBI_CMDLINE) ? From patchwork Mon Nov 20 22:49:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13462227 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 9A79DC2BB3F for ; Mon, 20 Nov 2023 22:49:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637325.993052 (Exim 4.92) (envelope-from ) id 1r5D54-0005Lt-RX; Mon, 20 Nov 2023 22:49:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637325.993052; Mon, 20 Nov 2023 22:49:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D54-0005Li-OT; Mon, 20 Nov 2023 22:49:26 +0000 Received: by outflank-mailman (input) for mailman id 637325; Mon, 20 Nov 2023 22:49:26 +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 1r5D54-0004rh-1M for xen-devel@lists.xenproject.org; Mon, 20 Nov 2023 22:49:26 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0d911e74-87f7-11ee-98e0-6d05b1d4d9a1; Mon, 20 Nov 2023 23:49:25 +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: 0d911e74-87f7-11ee-98e0-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700520565; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=c/mEDl4nIaExCRMi2dipvNsJyeJ3pq2/9bVYc4elcvc=; b=gs02KOr/y2tCt+xS7YqMa+mZF2160tPk7DXY28KxtDX4jxV415EhfUji vqnl9d9km+CTJjX7CZdaK5dF+l220dVIcRex9MTlwZYqQs0vA6yUpT3WI xMpO+3bCfS1HSoV7BACjPipYYSxPzxsx+vkilde+Qyoz0NObBe0a3wuBV A=; X-CSE-ConnectionGUID: WaXQkFtXSsexmHBFI/oWVg== X-CSE-MsgGUID: A4kbFKoySjesE7EgccrYIQ== Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 128662992 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:FZKGUaJ2JD4XcNl8FE+RN5UlxSXFcZb7ZxGr2PjKsXjdYENS0zFTm jdLCGGAa/qDNzT2e9hzaYix8kxSuJKEn4NnS1dlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAhk/nOHvylULKs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpKrfrfwP9TlK6q4mhB5wZmPaojUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5ICFF39 tIEGAsWYwCGp8iY4fW8dddj05FLwMnDZOvzu1llxDDdS/0nXYrCU+PB4towMDUY354UW6yEP oxANGspM0yojx5nYz/7DLoXmuuyi2a5WDpfsF+P/oI84nTJzRw327/oWDbQUoXQFZsLxBfJ/ Aoq+UzQXhIQGv+Y2AGH/2mB2cLAlijhaaMrQejQGvlC3wTImz175ActfUu2p7y1h1CzX/pbK lcI4Ww+oK4q7kupQ9LhGRqirxasnDQRRt5RGO0S8xyWx+zf5APxLnMfUjdLZdgitck3bT8nz FmEm5XuHzMHmKKRYWKQ8PGTtzzaESoIKW4PYwcUQA1D5MPsyKkNiRbIQsdmAbSCpNT/EjHtw BiHtCE7wb4UiKYj3aih4UrOhT7qo5HTVxM0/S3eRGfj5QR8DKa/YIal80Tcq/xJI4CQVFCpt mULgMWY46YFCpTlvCqMS+IJFfe36uqfMTvdqVRyEIIs8Tvr8HmmFb28+xkneh0vaJxdP2a0M QmM4Wu9+aO/IlOVZJ9OYKytO/8xwLjlNf7Ld7fTUeRBN80ZmBC8wM1+WaKB9zmyyBBwwP9lY MnzTCq6MZoN5U1aINuKqwQ1i+ZDKtgWnz+7eHwC503PPUCiTHCUU6wZF1CFc/o06qiJyC2Mr I4HapPXkUkGCbKgCsUyzWL1BQpSRZTcLcquw/G7i8bZelY2cI3fI6O5LUwdl3xNwP0Oy7agE oCVUU5E0lvv7UAr2i3TAk2PnIjHBM4lxVpiZHxEALpd8yR7CWpZxPtFJsRfkHhO3LAL8MOYu NFcKpnZX6wWEmuWk9nfBLGkxLFfmN2QrVrmF0KYjPIXJvaMmyShFgfYQzbS IronPort-HdrOrdr: A9a23:IYIENaOnLV/Rx8BcTvmjsMiBIKoaSvp037Eqv3oedfUzSL3gqy nOpoV86faaslYssR0b9exofZPwJE80lqQFhrX5X43SPzUO0VHAROoJgLcKgQeQfxEWntQtrZ uIGJIeNDSfNzdHZL7BkWuFL+o= X-Talos-CUID: 9a23:zrTsP2ggC6LxgXZzV/51me8Z+TJuTXTt9XT+P3+DEmt5TZ2/Z37X/5xanJ87 X-Talos-MUID: 9a23:tNyTDwWjzwsB7JHq/BawhztMF8B52KajE21SvJoNsNO1FBUlbg== X-IronPort-AV: E=Sophos;i="6.04,214,1695700800"; d="scan'208";a="128662992" 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 2/6] x86/setup: Rework cmdline_cook() to be compatible with -Wwrite-strings Date: Mon, 20 Nov 2023 22:49:08 +0000 Message-ID: <20231120224912.1421916-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231120224912.1421916-1-andrew.cooper3@citrix.com> References: <20231120224912.1421916-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Constify both cmdline variables in create_dom0() and __start_xen(). Initialise Xen's variable to the empty string to simplify the parsing logic. Update cmdline_cook() to take and return const pointers, changing it to have an early exit for a NULL input (which can happen if the mbi-> pointers happen to be 0). Note this only compiles because strstr() launders the const off the pointer when assigning to the mutable kextra, but that logic only mutates the mbi->cmdline buffer. Signed-off-by: Andrew Cooper Reviewed-by: Stefano Stabellini --- 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 I don't particularly like this, but it's the best I can come up with. --- xen/arch/x86/setup.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index c41dfdb2bdf8..a06a241943f6 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -837,9 +837,10 @@ static bool __init loader_is_grub2(const char *loader_name) return (p != NULL) && (p[5] != '0'); } -static char * __init cmdline_cook(char *p, const char *loader_name) +static const char *__init cmdline_cook(const char *p, const char *loader_name) { - p = p ? : ""; + if ( !p ) + return ""; /* Strip leading whitespace. */ while ( *p == ' ' ) @@ -885,7 +886,7 @@ static struct domain *__init create_dom0(const module_t *image, }, }; struct domain *d; - char *cmdline; + const char *cmdline; domid_t domid; if ( opt_dom0_pvh ) @@ -971,8 +972,8 @@ static struct domain *__init create_dom0(const module_t *image, /* SAF-1-safe */ void __init noreturn __start_xen(unsigned long mbi_p) { - const char *memmap_type = NULL, *loader; - char *cmdline, *kextra; + const char *memmap_type = NULL, *loader, *cmdline = ""; + char *kextra; void *bsp_stack; struct cpu_info *info = get_cpu_info(), *bsp_info; unsigned int initrdidx, num_parked = 0; @@ -1027,9 +1028,9 @@ void __init noreturn __start_xen(unsigned long mbi_p) : "unknown"; /* Parse the command-line options. */ - cmdline = cmdline_cook((mbi->flags & MBI_CMDLINE) ? - __va(mbi->cmdline) : NULL, - loader); + if ( mbi->flags & MBI_CMDLINE ) + cmdline = cmdline_cook(__va(mbi->cmdline), loader); + if ( (kextra = strstr(cmdline, " -- ")) != NULL ) { /* From patchwork Mon Nov 20 22:49:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13462228 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 5ED65C197A0 for ; Mon, 20 Nov 2023 22:49:51 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637323.993032 (Exim 4.92) (envelope-from ) id 1r5D52-0004rx-DC; Mon, 20 Nov 2023 22:49:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637323.993032; Mon, 20 Nov 2023 22:49:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D52-0004rq-A4; Mon, 20 Nov 2023 22:49:24 +0000 Received: by outflank-mailman (input) for mailman id 637323; Mon, 20 Nov 2023 22:49:22 +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 1r5D50-0004rh-8p for xen-devel@lists.xenproject.org; Mon, 20 Nov 2023 22:49:22 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 09775415-87f7-11ee-98e0-6d05b1d4d9a1; Mon, 20 Nov 2023 23:49:20 +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: 09775415-87f7-11ee-98e0-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700520560; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ypD7FL2deFYmmK/IKRzebizp0y0p5ZU6aoYIe+SpQ+E=; b=Qo4aGEf59stRJPiE1CtjmLl78cWVrYo4E1H153sT2ao5C6Rb3E8X8nim YqauCZfRpvZKjgEC95aWm4mjJ8HSdAri4IHEegz9Am5rWLiWke/2+2Zuq guXO2DuDS+1EIpfvwIBh38LF2Fjcn2tnZooI0Uuam6qN8bflJP9eqZZ8k 0=; X-CSE-ConnectionGUID: YZEIJDDgRpirGwCdt/oM8w== X-CSE-MsgGUID: I70KWNrSTtCQmBILCUNMbg== Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 128218323 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:Ddb7WKvnI+hiN0IbEWF3bfPExOfnVKpeMUV32f8akzHdYApBsoF/q tZmKWmFOanYYDOkcth+YIm2oUMA7MXQnd41HVRvqHtkEykV+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVaicfHg3HFc4IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4rKq5Fv0gnRkPaoQ5QaEzyFPZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMwGQIgTzKvq+2M2LOhZfZHithkK+y7I9ZK0p1g5Wmx4fcORJnCR+PB5MNC3Sd2jcdLdRrcT 5NHM3w1Nk2GOkAefAhPYH49tL7Aan3XWjtUsl+K44Ew5HDe1ldZ27nxKtvFPNeNQK25m27B/ DKcpjSiWEpy2Nq36GXd0U2KnNTzgQjCXagzMJaF0NtgjwjGroAUIEJPDgbqyRWjsWauVtQaJ 0EK9y4Gqakp6FftXtT7Rwe/onOPolgbQdU4O88Q5RyJy6HUyx2EHWVCRTlEAPQ9r9M/TzEu0 l6PnvvqCCZpvbnTTmiSnp+LqRuiNC5TKnUNDQcGUA8E7t/LsIw1yBXVQb5LLqmxidHkHCDq9 BqDpiM+mrY7gNYC0uOw+lWvqzihvITTRwg5oADeRHu47xhRbZSgIYev7DDz6PdLLI+dCF6br nUAs8Gb4KYFCpTlvDaKSugXALbv7f+KNjTGiHZlApY6+jKivXWkeOh45jB1I0NgdNgJZSXoZ k77sx5e/5JVMz2haqofXm6qI510l+66T42jD62FKIUWCnRsSOOZ1BBcSG+y80ziqlAti44gE puHNsGJXWlPXMyL0wGKq/chPa4Dn39mnT+CG8qikXyaPayiiGl5oIrp0WdijchjtctoWC2Pr 75i2zKikn2zqtHWbCjN6pI0JlsXN3U9Dp2eg5UILrbeelc8RDh4VKG5LVYdl2pNxfw9egDgp CnVZ6Ol4ACn2S2vxfuiNhiPl48Drb4g9ClmbETAzH6j2mQ5YJbH0UvsX8JfQFXTz8Q6laQcZ 6BcK6297gFnFmyvF8I1McOs8+SPtX2D2WqzAsZSSGFuI8c9H1WRpY6Mk8mG3HBmMxdbfPAW+ 9WIvj43i7JaL+i+JK46sM6S8m4= IronPort-HdrOrdr: A9a23:Qg0TUKwbsyisPe6XsK9jKrPwFL1zdoMgy1knxilNoRw8SKKlfq eV7Y0mPH7P+VAssR4b+exoVJPtfZqYz+8R3WBzB8bEYOCFghrKEGgK1+KLqFeMJ8S9zJ846U 4JSdkHNDSaNzlHZKjBjzVQa+xQouW6zA== X-Talos-CUID: 9a23:1WMCkmBmO6wAe1P6ExhV2W82NuwqSGXc1ljPCEOkTmFMGKLAHA== X-Talos-MUID: 9a23:xvDCJQXSh1DZ7Mrq/B6z3BJdEt1T37iFMUUnsLEthu+hPyMlbg== X-IronPort-AV: E=Sophos;i="6.04,214,1695700800"; d="scan'208";a="128218323" 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 , Michal Orzel , Roberto Bagnara , Nicola Vetrini Subject: [PATCH 3/6] xen/efi: Make efi-boot.h compile with -Wwrite-strings Date: Mon, 20 Nov 2023 22:49:09 +0000 Message-ID: <20231120224912.1421916-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231120224912.1421916-1-andrew.cooper3@citrix.com> References: <20231120224912.1421916-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 GCC complains: In file included from arch/arm/efi/boot.c:700: arch/arm/efi/efi-boot.h: In function 'efi_arch_handle_cmdline': arch/arm/efi/efi-boot.h:482:16: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] 482 | name.s = "xen"; | ^ There's no easy option. .rodata is really read-only, so the fact Xen doesn't crash means these strings aren't written to. Lie to the compiler using a union. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Roberto Bagnara CC: Nicola Vetrini I *really* don't like this, but it's the only suggestion given. --- xen/arch/arm/efi/efi-boot.h | 2 +- xen/arch/x86/efi/efi-boot.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 1c3640bb65fd..c26bf18b68b9 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -479,7 +479,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, w2s(&name); } else - name.s = "xen"; + name.cs = "xen"; /* TODO, find a better way of doing this. */ prop_len = 0; prop_len += snprintf(buf + prop_len, diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index eebc54180bf7..e2d256e0517b 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -324,7 +324,8 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, w2s(&name); } else - name.s = "xen"; + name.cs = "xen"; /* TODO, find a better way of doing this. */ + place_string(&mbi.cmdline, name.s); if ( mbi.cmdline ) From patchwork Mon Nov 20 22:49:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13462226 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 BB937C54E76 for ; Mon, 20 Nov 2023 22:49:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637328.993078 (Exim 4.92) (envelope-from ) id 1r5D59-0005yz-Qu; Mon, 20 Nov 2023 22:49:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637328.993078; Mon, 20 Nov 2023 22:49:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D59-0005yU-Il; Mon, 20 Nov 2023 22:49:31 +0000 Received: by outflank-mailman (input) for mailman id 637328; Mon, 20 Nov 2023 22:49:30 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D58-0005pp-0G for xen-devel@lists.xenproject.org; Mon, 20 Nov 2023 22:49:30 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0d40d0f7-87f7-11ee-9b0e-b553b5be7939; Mon, 20 Nov 2023 23:49:26 +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: 0d40d0f7-87f7-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700520566; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KkoH8o86oD3O0Ak+wVVUBX4N9gH8HsFtd6JZOUHqS1o=; b=c09Exnye5lku1hWOJRPzaKZfyY1Tmv9FR37eZjlRO8FgQVezXdQ+6TsH 0+Od9eQCr93rJex1VUvxmyc9K4Z/7jJe2V4kYf1fK9BPU6pONsUQVqYUi 0GmladJGPzG9M0Tq1B/WHFTBuEskn4w1tZsWc+Muvpo+kiWdQB44E/YDT E=; X-CSE-ConnectionGUID: LtYo8xJLRvC+jqiF6E23hw== X-CSE-MsgGUID: 6O6XcPceSZ2koK5f5Nn6tg== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127436305 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:3MPTDq+LoP2SHNuUIsiQDrUDX36TJUtcMsCJ2f8bNWPcYEJGY0x3m GJLWGuAbPiLN2qgf9wgboTg8U4D75aEm4NhTAJs+yA8E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjVAOK6UKidYnwZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ird7ksz1BjOkGlA5AdnPKoT5AW2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklq6 c0feCAvSiqdrKG02bOVFMQ23cQ8eZyD0IM34hmMzBncBPciB5vCX7/L9ZlT2zJYasJmRKiEI ZBDMHw2MUWGPEUn1lQ/UfrSmM+BgHXlfiIeg1WSvactuEDYzRBr0airO93QEjCPbZwPwRrD+ DmeogwVBDlEE4KvwgKO/0me3OzIvn71BaQUSqG3o6sCbFq7mTVIVUx+uUGAiem0jAuyVsxSL 2QQ+zEytu4i+UqzVN7/Uhak5nmesXY0QMFMGuc37AWMzKv84AuDAGUACDlbZ7QOttIyRDEs/ k+EmZXuHzMHmIOSTXWR57KFtwSYMCIeLXIBTSIcRA5D6N7myKk5gwjTVN9lHOiwh8fsBDDr6 zmQqW41gLB7pcsK3KWy+RbAmSChorDASwJz7QLSNkq/6Ql0fpKiIYah5l7S9/9oJpuWVVSHs z4PnM32xOYPBpaJnWqTTfkXHbeoz/yYPybRh1EpFJ4knwlB4Fb6I9oWumsnYh40Y4BbIVcFf XM/pyt1+K5UbGuISZVpSMGzEsUEk4W6TtT6A6W8gsV1XnRhSOOW1HgxPRbMjj63yRZErE0pB XuMnS+R4Zcm5UdPlmPeqx81i+ND+8zH7Tq7qWrH5xqmy6GCQ3WeVK0INlCDBshgs/vc/V2Iq YoGbpTUo/m6bAEYSnOPmWL0BQpSRUXX+Lis85AHHgJ9ClYO9J4d5w/5nup6Jt0Nc1V9nebU5 HCtMnK0O3Km7UAr3T6iMyg5AJu2BMYXkJ7OFXB0Vbpe8yR5MNnHAWZ2X8dfQITLA8Q6nKItE qFcI5rRahmNIxyekwkggVDGhNQKXHyWacimZkJJvBBXk0ZcejH0 IronPort-HdrOrdr: A9a23:rRuryKuMF6MG75yJeqwIG/u67skDTtV00zEX/kB9WHVpmszxra 6TdZMgpHnJYVcqKQkdcL+7WJVoLUmxyXcx2/h1AV7AZniAhILLFvAA0WKK+VSJcEeSygce79 YFT0EXMqyIMbEQt6fHCWeDfOrIuOP3kpyVuQ== X-Talos-CUID: 9a23:gxaWTW7h4b5VFXWyf9ss0FIlHZA1UFnn0lyTIVa5JzhEEuaVVgrF X-Talos-MUID: 9a23:Nr5UswmcUORqbrt/l8Sfdno8E5lY6JylBXs/y5YBmJSKaAp2ZSuS2WE= X-IronPort-AV: E=Sophos;i="6.04,214,1695700800"; d="scan'208";a="127436305" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Roberto Bagnara , Nicola Vetrini Subject: [PATCH 4/6] arm/duart: make dt_uart_init() compile with -Wwrite-strings Date: Mon, 20 Nov 2023 22:49:10 +0000 Message-ID: <20231120224912.1421916-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231120224912.1421916-1-andrew.cooper3@citrix.com> References: <20231120224912.1421916-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 GCC complains: drivers/char/arm-uart.c: In function 'dt_uart_init': drivers/char/arm-uart.c:81:17: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] 81 | options = ""; | ^ The problem is using the options string for both splitting opt_duart, and to hold a token "" for no options. Use two variables; one mutable one one const. Signed-off-by: Andrew Cooper Reviewed-by: Stefano Stabellini --- CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Roberto Bagnara CC: Nicola Vetrini --- xen/drivers/char/arm-uart.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/drivers/char/arm-uart.c b/xen/drivers/char/arm-uart.c index 8098a968c285..91f13a41368d 100644 --- a/xen/drivers/char/arm-uart.c +++ b/xen/drivers/char/arm-uart.c @@ -42,7 +42,8 @@ static void __init dt_uart_init(void) struct dt_device_node *dev; int ret; const char *devpath = opt_dtuart; - char *options; + const char *options; + char *split; if ( !console_has("dtuart") ) return; /* Not for us */ @@ -74,9 +75,12 @@ static void __init dt_uart_init(void) return; } - options = strchr(opt_dtuart, ':'); - if ( options != NULL ) - *(options++) = '\0'; + split = strchr(opt_dtuart, ':'); + if ( split ) + { + split[0] = '\0'; + options = split + 1; + } else options = ""; From patchwork Mon Nov 20 22:49:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13462225 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 49480C2BB3F for ; Mon, 20 Nov 2023 22:49:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637326.993062 (Exim 4.92) (envelope-from ) id 1r5D56-0005bg-2k; Mon, 20 Nov 2023 22:49:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637326.993062; Mon, 20 Nov 2023 22:49:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D55-0005bZ-W3; Mon, 20 Nov 2023 22:49:27 +0000 Received: by outflank-mailman (input) for mailman id 637326; Mon, 20 Nov 2023 22:49:27 +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 1r5D54-0004rh-Ud for xen-devel@lists.xenproject.org; Mon, 20 Nov 2023 22:49:26 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0d453ff8-87f7-11ee-98e0-6d05b1d4d9a1; Mon, 20 Nov 2023 23:49:25 +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: 0d453ff8-87f7-11ee-98e0-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700520565; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EVJR9V5+k1L0Xv34e64y+YGh6kPJI63dNHLzn39U6pA=; b=icIo2ZNdPWV0gjqVlGhvtX78q2xZMaRMYsmmWPRPn18Qdy0Ipky8SWq/ xNkwSec/chVRf7S8sPHk6nsZ8nLwYgrcLwcr/7r5cNRE8U1Lg2sBKO+QS 6o0xSzE9BEovptx0wXh9Hvt9M9gfKojHym1uWKGprx6/hH/U+6O2jJmh7 M=; X-CSE-ConnectionGUID: WaXQkFtXSsexmHBFI/oWVg== X-CSE-MsgGUID: vYXeQnT6QZ6dKD6x9aj9UQ== Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 128662993 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:7Yx7WaOvDVN+r2vvrR16l8FynXyQoLVcMsEvi/4bfWQNrUog0zECz GMaWmDSOavYYGWjLthxbd/ioUlX7cSGyoVgGQto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CQ6jefQAOOkVIYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGjxSs/7rRC9H5qyo42pB5ARmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0tl+MVhN2 +AoEysAfhWjrcyXh7WEdOY506zPLOGzVG8eknRpzDWfBvc6W5HTBa7N4Le03h9p2JoIR6yHI ZNEOHwwNHwsYDUWUrsTILs4kP2lmT/UdDpApUjOjaE2/3LS3Ep6172F3N/9I4baG5sPzxfDz o7A13rIMhwjMuDB8Ajb/lGA2P+elCGqZbtHQdVU8dY12QbOlwT/EiY+RVa95PW0lEO6c9ZeM FAPvDojq7Ao806mRcW7WAe3yFafpQIVUddUF+w86SmOx7DS7gLfAXILJhZDddgnuckeVTEsk FiTkLvBOztrt7GETGOHwZ2dpziyJCs9IHcLYGkPSg5ty9Puup0phxTDCNNqCreoj8bdECv1h TuNqUAWgrQYjccPkaKh713Dqzupqt7CSQtdzh/QVG+/8gQ/boeqYYWy4HDR8PlbIYCWCFKGu RAsncmV6+QHS4+AiDaMRuQlFqym/PuDP3vXhlsHInU6323zoTj5J9kWuWwvYhgxWioZRdP3S HDaiTpSyoNjB2CnfapXSayQTMMV86e1QLwJScvogspyjolZLVDfpH0/OxTJgQjQfF4QfbbT0 Kp3kPpA7l5AUMyLNBLsG48gPUYDn0jSP1/7S5Hh1AiA2rGDfnOTQrptGALRNrhktP7e/FyMr Ig32y62J/N3CrWWjs7/q9Z7ELz3BSJjWcCeRzJ/KoZv3TaK6El+UqSMkNvNiqRunrhPl/egw 51OchYw9bYLvlWecV/iQik6ONvSsWNX8SpT0doEYQz5hBDOoO+HsM8iSnfAVeB2qLU+lacsE KhtlgfpKq0ndwkrMg81NfHVxLGOvjzy7e5SF0JJuAQCQqM= IronPort-HdrOrdr: A9a23:NgNX+ai79DJOlJx7BX2/oURwDXBQXuIji2hC6mlwRA09TySZ// rBoB19726MtN9xYgBHpTnuAsm9qB/nmaKdpLNhWItKPzOW31dATrsSjrcKqgeIc0aVm9K1l5 0QF5SWYOeAdWSS5vya3ODXKbkdKaG8gcKVuds= X-Talos-CUID: 9a23:jsly/2sWA5XPJ2tPQJv9A9+36Isae03kz1nME3SjBHZsaJe7aBiXx51rxp8= X-Talos-MUID: 9a23:AkEUMg4FyJ26Mo7pnZGtscHYxox20pSjMUYxz6w05cWnGXJgaj6f3QmOF9o= X-IronPort-AV: E=Sophos;i="6.04,214,1695700800"; d="scan'208";a="128662993" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Roberto Bagnara , Nicola Vetrini Subject: [PATCH 5/6] arm/platforms: Make compatbile with -Wwrite-strings Date: Mon, 20 Nov 2023 22:49:11 +0000 Message-ID: <20231120224912.1421916-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231120224912.1421916-1-andrew.cooper3@citrix.com> References: <20231120224912.1421916-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 GCC complains: arch/arm/platforms/brcm.c: In function ‘brcm_populate_plat_regs’: arch/arm/platforms/brcm.c:76:27: error: passing argument 1 of ‘brcm_get_dt_node’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 76 | rc = brcm_get_dt_node("brcm,brcmstb-cpu-biu-ctrl", &node, ®_base); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ and arch/arm/platforms/exynos5.c: In function ‘exynos5_smp_init’: arch/arm/platforms/exynos5.c:109:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 109 | compatible = "samsung,exynos4210-sysram-ns"; | ^ In both cases, just make the relevant variable const. Signed-off-by: Andrew Cooper Reviewed-by: Stefano Stabellini --- CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Roberto Bagnara CC: Nicola Vetrini --- xen/arch/arm/platforms/brcm.c | 2 +- xen/arch/arm/platforms/exynos5.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/platforms/brcm.c b/xen/arch/arm/platforms/brcm.c index 951e4d6cc328..43a07ab1a69d 100644 --- a/xen/arch/arm/platforms/brcm.c +++ b/xen/arch/arm/platforms/brcm.c @@ -35,7 +35,7 @@ static u32 brcm_boot_continuation_pc; static struct brcm_plat_regs regs; -static __init int brcm_get_dt_node(char *compat_str, +static __init int brcm_get_dt_node(const char *compat_str, const struct dt_device_node **dn, u32 *reg_base) { diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c index c48093cd4fa4..f7c09520675e 100644 --- a/xen/arch/arm/platforms/exynos5.c +++ b/xen/arch/arm/platforms/exynos5.c @@ -96,7 +96,7 @@ static int __init exynos5_smp_init(void) { struct dt_device_node *node; void __iomem *sysram; - char *compatible; + const char *compatible; paddr_t sysram_addr; paddr_t size; paddr_t sysram_offset; From patchwork Mon Nov 20 22:49:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13462229 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 75115C2BB3F for ; Mon, 20 Nov 2023 22:49:52 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637329.993086 (Exim 4.92) (envelope-from ) id 1r5D5A-0006BT-Fk; Mon, 20 Nov 2023 22:49:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637329.993086; Mon, 20 Nov 2023 22:49:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D5A-00069C-6x; Mon, 20 Nov 2023 22:49:32 +0000 Received: by outflank-mailman (input) for mailman id 637329; Mon, 20 Nov 2023 22:49:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D59-0005pp-0K for xen-devel@lists.xenproject.org; Mon, 20 Nov 2023 22:49:31 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0fd74cc1-87f7-11ee-9b0e-b553b5be7939; Mon, 20 Nov 2023 23:49:29 +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: 0fd74cc1-87f7-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700520568; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3sQs0NPyCIz2F9DlyYtFEywO02GaqviYPBmMjYsQYss=; b=dLHAXekwU4/8cDc8QBozO3tlmyc6zRMxWzD+rhWzcaAuoi/3ZebGK2uA SZUq/woY/PZBKbvfR0VDcwJzE7c6OFQvwpTh9Nj2VMOi9+r1Mj26vRoRe tmMpPgrqnUOxdVKa6Wk55xkcZjnLU4/0SsExL8NmSMxFLO+ukJ0VP9oHr Y=; X-CSE-ConnectionGUID: LtYo8xJLRvC+jqiF6E23hw== X-CSE-MsgGUID: MYjbWUHGQ3Of01rMr+BAKQ== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127436306 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:ViszRKnytzLpQl+33q/RHQLo5gx9JkRdPkR7XQ2eYbSJt1+Wr1Gzt xIbW22CafaMYmD0KNElaonk9xlT6pDUxtI2SwVrqy41RSMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+e6UKicfHkpGWeIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE0p5KiaVA8w5ARkPqkS5geGzRH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 dgEGTddfjKnvfydg7CiS8cyq554LNa+aevzulk4pd3YJfMvQJSFSKTW/95Imjw3g6iiH96HO ZBfM2A2Kk2dMlsQYj/7C7pn9AusrlD5fydVtxS+oq0v7nKI5AdwzKLsIJzefdniqcB9xxzH+ jmYpDynav0cHPmuyzC6z1KDv7Tok3uiQqcIV5eR1cc/1TV/wURMUUZLBDNXu8KRmkO4Ht5SN UEQ0i4vtrQpslymSMHnWB+1q2LCuQQTM/JyOeAn7ACGyoLP/h2UQGMDS1Zpc8c6vcU7QTgr0 F6hnN7zAzFr9rqPRhq16bO8vT60fy8PIgcqZzIATAYDy8nupsc0lB2nZuhkFKm5n9jkAwbay jqBrDU9r7gLhMtN3KK+lXjNjiiwvJHPQkgw7x/OQ2O+xgpjYciuYInAwV3a5vZJKMCeVEuMu FANnsTY5+cLZbmXkyaAWvkKWrug6PCMKjT0i0NgBJQn+HKm/HvLVYZR6zZ6LQF3P9oeeDnoS EXOthhc4pAVN3yvBZKbeKroVZ5sl/K5U424B7aLNrKif6Sdaiej4BBpNV6y+1rzuwsuiKARZ 7rBKsazWCNy5btc8NamewsM+eZ0nnhilD2JHM6T8vix7VaJiJeopVY53LimNLlRAFus+lm9z jqmH5LiJ+9jeOP/eDLL1oUYMEoHK3M2bbiv9JQPK7beeFY/QT5/YxM0/V/HU9Y990iyvr2Ql kxRp2cCkAav7ZE5AVniho9fhEPHAs8k8CNT0d0ENle0wXkzCbtDH49GH6bbiYIPrbQ5pdYtF qltRil1KqgXItgx02hHPMaVQU0LXEjDuD9iyAL8MWRmIsY5H1OYkjImFyO2nBQz4uOMnZNWi 9WdOsnzGPLvmywK4B7qVc+S IronPort-HdrOrdr: A9a23:HeWtGK4ZLHCFQbq/1QPXwPDXdLJyesId70hD6qhwISY6TiX+rb HWoB17726TtN9/YhEdcLy7VJVoBEmskKKdgrNhWotKPjOW21dARbsKheCJrgEIWReOktK1vZ 0QC5SWY+eQMbEVt6nHCXGDYrQd/OU= X-Talos-CUID: 9a23:XzENrGiZe9EO+Vz12OZbakUkGjJuVmHsyyfAAWuCF00qSqSUZwG9ovhkjJ87 X-Talos-MUID: 9a23:hQ7Htg5xisfcDZK0sJ6dIuetxoxN0qakN30tvqxdnMfcbDZVIXS3pReOF9o= X-IronPort-AV: E=Sophos;i="6.04,214,1695700800"; d="scan'208";a="127436306" 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 , Michal Orzel , Roberto Bagnara , Nicola Vetrini Subject: [PATCH 6/6] xen: Enable -Wwrite-strings Date: Mon, 20 Nov 2023 22:49:12 +0000 Message-ID: <20231120224912.1421916-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231120224912.1421916-1-andrew.cooper3@citrix.com> References: <20231120224912.1421916-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 The codebase is now -Wwrite-strings clean. Activate the option to cause string literals to have a const type, and prevent any violations of MISRA Rule 7.4 being reintroduced. Signed-off-by: Andrew Cooper Acked-by: Stefano Stabellini --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Roberto Bagnara CC: Nicola Vetrini --- xen/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/Makefile b/xen/Makefile index 7b869f4b3037..ca571103c868 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -392,7 +392,7 @@ endif CFLAGS-$(CONFIG_CC_SPLIT_SECTIONS) += -ffunction-sections -fdata-sections CFLAGS += -nostdinc -fno-builtin -fno-common -CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith +CFLAGS += -Werror -Wredundant-decls -Wwrite-strings -Wno-pointer-arith $(call cc-option-add,CFLAGS,CC,-Wvla) CFLAGS += -pipe -D__XEN__ -include $(srctree)/include/xen/config.h CFLAGS-$(CONFIG_DEBUG_INFO) += -g