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

Re: [PATCH 9/9] drivers/acpi: Use explicitly specified types


  • To: Michal Orzel <michal.orzel@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 22 Jun 2022 12:36:33 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=THiQZQA9BYFFOtXzxLC2xtyzASzx6KnHD9/p/+q81Eo=; b=Ro/O/U9b1trsTdvhiMwdYahM9apcp+p3ZByKyM4aBgKNWjapI+zjUitavgXn99FX4KuBzwuuR7WdFeCaxljlqSRKSU81xgZi5kB6Fk60EiTToxgeYucKDpFpLksYXpcPgv2elpfpTXcfguIT2LQ1JuqTEC/JNwqxBIrIBGs+pB82tsqUc2TSkyFkHD91d0By3o6kTb547CC4Oi1hxILHPgwPaTS/wQvFdViHTLXZL+ckX//x349lvECqOZ/bnmPgOXLPnav/q3bit9uK+lrHHRJEn/wGPW2QjedRWkdba6z0L8+6JtXljtNeu3qtuFsTInEtBJKX/1w6voNvdqJPrw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D5kPfimPc2LRcNJLrDLYrQPRRUod1PxcQFijYHOOjEtciQD9X1iLgmoPzZVWwn7blqVoKrsQuy+pH6HnRZmyzdG1Kex8/3zCnfH0/2ICroiivgEN0NNNK1zAV06ddYRRN3Z8kZ7GdOrY5myV4cO/xynxHFwN42acyrX7P3pWKTcnsfFeQzAIR0W/LqXZjueFfuSvCwHS5Je+xpovQvnXdrMTt8nYh0cBxVqlpbWs9NcX4F0XXUXem1etWWnZFtIHr/yN/hV9FWY+lPwfsJDfS5CSRNkSeaQwlRqh4JMqHhovQi95GCYAw2DdeGRVkrtlmLGgCi6lP6E9JEIbC792ZQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 22 Jun 2022 10:36:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.06.2022 09:02, Michal Orzel wrote:
> According to MISRA C 2012 Rule 8.1, types shall be explicitly
> specified. Fix all the findings reported by cppcheck with misra addon
> by substituting implicit type 'unsigned' to explicit 'unsigned int'.
> 
> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
> ---
> This patch may not be applicable as these files come from Linux.

We've diverged quite far, so the Linux origin isn't really a concern
(anymore).

> --- a/xen/drivers/acpi/tables/tbfadt.c
> +++ b/xen/drivers/acpi/tables/tbfadt.c
> @@ -235,7 +235,7 @@ void __init acpi_tb_create_local_fadt(struct 
> acpi_table_header *table, u32 lengt
>               ACPI_WARNING((AE_INFO,
>                             "FADT (revision %u) is longer than ACPI 5.0 
> version,"
>                             " truncating length %u to %zu",
> -                           table->revision, (unsigned)length,
> +                           table->revision, (unsigned int)length,

Since we generally try to avoid casts where not needed - did you consider
dropping the cast here instead of fiddling with it? Aiui this wouldn't be
a problem since we assume sizeof(int) >= 4 and since types more narrow
than int would be converted to int (which in turn is generally printing
okay with %u). Strictly speaking it would want to be PRIu32 ...

> --- a/xen/drivers/acpi/tables/tbutils.c
> +++ b/xen/drivers/acpi/tables/tbutils.c
> @@ -481,7 +481,7 @@ acpi_tb_parse_root_table(acpi_physical_address 
> rsdp_address, u8 flags)
>                       if (ACPI_FAILURE(status)) {
>                               ACPI_WARNING((AE_INFO,
>                                             "Truncating %u table entries!",
> -                                           (unsigned)
> +                                           (unsigned int)
>                                             (acpi_gbl_root_table_list.size -
>                                              acpi_gbl_root_table_list.
>                                              count)));

Same here then, except PRIu32 wouldn't be correct to use in this case.

Jan



 


Rackspace

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