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

Re: [XEN PATCH v2 11/13] xen/vpci: fix violations of MISRA C:2012 Rule 7.2


  • To: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 6 Jul 2023 10:07:41 +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=tFZoEIrQU47U0K+QZ8IYQiWuvPurugmP0N4JzpVB1w4=; b=nLSnzDlQtvaRPBDnWEcnzzm1M5RoJcqii/XxI3qmdqSmajsFpWhxX5m+1aICBYs+GdsfJhLDGKYzP4OIuD/p05SXBmBpVMiUhsqGTe4q5Xk55hdpWbuw/90xzE7rfwsNSFXgYOrYDjtfOGs67n7WVG0ng4EjU4xLKr8Je7iOlrHrKApcLSxNEcht5rX5mY1PjdZ/mFEbmCJTTlPnIURkD/MR+mXXJj5BBhVR4VectIsALLJ162fdeifYvcezMhoBc1/a8Mvsa23hDiO+V3ulvvpcZJ2wGgFbAqTvwwTbKkozz2rs5y1YirUHyKa3rme9DyJbO21QRao8mvC8DvVF8w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kiWkJ536bqj5oN3/lG0/t54Z4hBP+yHy4IWOIL6H/pC/f8B/tE/+9cRNeNW2yh31LgOXwqZXmG6TiJGi9ute1WfXTvIXNAD9AnuBM1tZCFhy9nb2pL3mfp/48ip3dKV4yhucxrRc4/o97VkwOFA/LCukX3rqLVKF0t4U4UT/nIdez5hdOHcxn1nxDx9Pg3hALAN8fTGc3qozkaAfQOl92UGh6ASJw6vZUO3SkWd4+2uW5aIRuMoVEVefh4bQoHO8KjRA93oJCF0XrtpL0PJiVZ4WfdMX50/yPJgSFbx0QYwlGwFUpGjN/5KfAnMg/MsSbJ+u83f7BevTHFGrPBzIQA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: consulting@xxxxxxxxxxx, Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Xenia Ragiadakou <Xenia.Ragiadakou@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 06 Jul 2023 08:07:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05.07.2023 17:26, Simone Ballarin wrote:
> --- a/xen/drivers/vpci/msi.c
> +++ b/xen/drivers/vpci/msi.c
> @@ -124,7 +124,7 @@ static void cf_check address_hi_write(
>      struct vpci_msi *msi = data;
>  
>      /* Clear and update high part. */
> -    msi->address &= 0xffffffff;
> +    msi->address &= 0xffffffffU;
>      msi->address |= (uint64_t)val << 32;

Along the lines of the comment to an earlier patch and considering that
a cast to uint64_t is already present here, I again wonder whether
switching to casting to uint32_t wouldn't be the better change.

> --- a/xen/drivers/vpci/msix.c
> +++ b/xen/drivers/vpci/msix.c
> @@ -531,7 +531,7 @@ static int cf_check msix_write(
>  
>      case PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET:
>          entry->updated = true;
> -        entry->addr &= 0xffffffff;
> +        entry->addr &= 0xffffffffU;
>          entry->addr |= (uint64_t)data << 32;
>          break;

Same here then.

Jan



 


Rackspace

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