[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/4] xen/arm: acpi: resolve MISRA C Rule 11.8 in acpi_xsdt_modify_entry()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Tue, 17 Nov 2026 21:47:09 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+LwSGq8fK2oVQtlAGFozOKBY4/mb8ctFXpYZJncJDVo=; b=Jy/+dj28uyFc4sGiE+V1pA2GcbGAjejBMAxwod6yaP+1SFRCga0HdS5EHEWdaUrtWf0uUVqKBrC5LfuZt3SpXooufbJaMvZMSXRVw4qyfw5JsHW7g9tabCsWD5zg1SKko06qr+ajFHDJA/xn3bfYYLMR6tCS7p+RjeS2ILMNc1+Q6HwKYfO1DEdd5MW1u3e2cP0AbzMtSaYy6b3uaSwAR927wVtzoO6sNxKe4ZbMNSdy8vDJbFhbxY/M+OyhavCez20mBeeBWXdlzqwbcpsDneA7yBVLTOyVUIcsV1yKLGua4pxzgmrYZDbPEI4T7fM5VC0KexbCl8VgTofd22HjDA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UhS22RopC45Yb8CoxisYXq8x9ACCIfcJKGhC0vQtj3E8aIA6vs5luDmOCstYclqXY7/tFSjAe02b/hdjrEA9cqnorOLc5PESE5Q+ZcoC9kyzcT2Hg+akGhC0iEY/QxxTubglaSqGZKSUQfLD2WI153aE+D4xKq9jOmCvX+KDB8EMurGDgvJYQQ5wvg/OZA7BL+xGRDHiaBmksdC6cMitErFUBQxxb/1CGZy0lvDTE6djhYsRb3taG557Wzxnkafka3P3Cb2JD35cZNoHCTlOZ2+ocMkCw4EjNi/KsW8nuDGOxynByzW/WX6fezmTctWNNT1GR+jShiE265gUZ62Xtg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 17 Nov 2026 19:47:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 11/3/26 12:34, Jan Beulich wrote:
On 03.11.2026 11:29, Dmytro Prokopchuk1 wrote:
ACPI_COMPARE_NAME() casts both of its arguments to 'u32 *' through
ACPI_CAST_PTR(). The 'signature' argument of acpi_xsdt_modify_entry()
is 'const char *', so the macro casts away its const-ness, which is
a violation of MISRA C Rule 11.8.

Use strncmp() with ACPI_NAME_SIZE instead. It takes 'const char *'
arguments, so no cast is needed at all. It also avoids reading a 'u32'
through a possibly unaligned char pointer.

No functional changes.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>

Worth mentioning perhaps that this (apparently) is an alternative to
https://lists.xen.org/archives/html/xen-devel/2026-09/msg00044.html.


Thanks for pointing that out. I should have referenced your patch.

Jan

--- a/xen/arch/arm/acpi/domain_build.c
+++ b/xen/arch/arm/acpi/domain_build.c
@@ -253,7 +253,7 @@ static void __init acpi_xsdt_modify_entry(u64 entry[],
      for( i = 0; i < entry_count; i++ )
      {
          table = acpi_os_map_memory(entry[i], size);
-        if ( ACPI_COMPARE_NAME(table->signature, signature) )
+        if ( !strncmp(table->signature, signature, ACPI_NAME_SIZE) )
          {
              entry[i] = addr;
              acpi_os_unmap_memory(table, size);


Dmytro.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.