All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simone Ballarin <simone.ballarin@bugseng.com>
To: xen-devel@lists.xenproject.org
Cc: consulting@bugseng.com,
	"Gianluca Luparini" <gianluca.luparini@bugseng.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Xenia Ragiadakou" <Xenia.Ragiadakou@amd.com>,
	"Ayan Kumar Halder" <ayan.kumar.halder@amd.com>,
	"Simone Ballarin" <simone.ballarin@bugseng.com>
Subject: [XEN PATCH v2 11/13] xen/vpci: fix violations of MISRA C:2012 Rule 7.2
Date: Wed,  5 Jul 2023 17:26:33 +0200	[thread overview]
Message-ID: <4b4fad089f8fc85db19b33524ea6b14b1aef7cbb.1688559115.git.gianluca.luparini@bugseng.com> (raw)
In-Reply-To: <cover.1688559115.git.gianluca.luparini@bugseng.com>

From: Gianluca Luparini <gianluca.luparini@bugseng.com>

The xen sources contains violations of MISRA C:2012 Rule 7.2 whose
headline states:
"A 'u' or 'U' suffix shall be applied to all integer constants
that are represented in an unsigned type".

Add the 'U' suffix to integers literals with unsigned type and also to other
literals used in the same contexts or near violations, when their positive
nature is immediately clear. The latter changes are done for the sake of
uniformity.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changes in v2:
- minor change to commit title
- change commit message
---
 xen/drivers/vpci/msi.c  | 2 +-
 xen/drivers/vpci/msix.c | 2 +-
 xen/drivers/vpci/vpci.c | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
index 8f2b59e61a..7908a5dac6 100644
--- 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;
 
     update_msi(pdev, msi);
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index 25bde77586..d440ffcd81 100644
--- 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;
 
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index d73fa76302..3bec9a4153 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -319,7 +319,7 @@ static void vpci_write_hw(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
 static uint32_t merge_result(uint32_t data, uint32_t new, unsigned int size,
                              unsigned int offset)
 {
-    uint32_t mask = 0xffffffff >> (32 - 8 * size);
+    uint32_t mask = 0xffffffffU >> (32 - 8 * size);
 
     return (data & ~(mask << (offset * 8))) | ((new & mask) << (offset * 8));
 }
@@ -402,7 +402,7 @@ uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int size)
         data = merge_result(data, tmp_data, size - data_offset, data_offset);
     }
 
-    return data & (0xffffffff >> (32 - 8 * size));
+    return data & (0xffffffffU >> (32 - 8 * size));
 }
 
 /*
@@ -427,7 +427,7 @@ static void vpci_write_helper(const struct pci_dev *pdev,
         data = merge_result(val, data, size, offset);
     }
 
-    r->write(pdev, r->offset, data & (0xffffffff >> (32 - 8 * r->size)),
+    r->write(pdev, r->offset, data & (0xffffffffU >> (32 - 8 * r->size)),
              r->private);
 }
 
-- 
2.41.0



  parent reply	other threads:[~2023-07-05 15:27 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 15:26 [XEN PATCH v2 00/13] xen: fix violations of MISRA C:2012 Rule 7.2 Simone Ballarin
2023-07-05 15:26 ` [XEN PATCH v2 01/13] x86/cpufreq: " Simone Ballarin
2023-07-05 23:29   ` Stefano Stabellini
2023-07-06  7:44     ` Jan Beulich
2023-07-05 15:26 ` [XEN PATCH v2 02/13] AMD/IOMMU: " Simone Ballarin
2023-07-05 23:31   ` Stefano Stabellini
2023-07-06  7:48     ` Jan Beulich
2023-07-05 15:26 ` [XEN PATCH v2 03/13] x86/svm: " Simone Ballarin
2023-07-06  7:52   ` Jan Beulich
2023-07-05 15:26 ` [XEN PATCH v2 04/13] xen/arm: " Simone Ballarin
2023-07-05 16:27   ` Luca Fancellu
2023-07-05 16:42     ` Julien Grall
2023-07-05 15:26 ` [XEN PATCH v2 05/13] xen/device-tree: " Simone Ballarin
2023-07-05 16:28   ` Luca Fancellu
2023-07-05 23:32   ` Stefano Stabellini
2023-07-06  8:01   ` Julien Grall
2023-07-05 15:26 ` [XEN PATCH v2 06/13] xen/efi: " Simone Ballarin
2023-07-05 16:34   ` Luca Fancellu
2023-07-05 23:37   ` Stefano Stabellini
2023-07-06  7:55     ` Jan Beulich
2023-07-06 22:14       ` Stefano Stabellini
2023-07-05 15:26 ` [XEN PATCH v2 07/13] x86/vmx: " Simone Ballarin
2023-07-05 23:39   ` Stefano Stabellini
2023-07-06  8:04   ` Jan Beulich
2023-07-06 22:17     ` Stefano Stabellini
2023-07-07  6:44       ` Jan Beulich
2023-07-07  8:18     ` Simone Ballarin
2023-07-05 15:26 ` [XEN PATCH v2 08/13] xen/pci: " Simone Ballarin
2023-07-06  8:05   ` Jan Beulich
2023-07-05 15:26 ` [XEN PATCH v2 09/13] xen/public: " Simone Ballarin
2023-07-05 15:33   ` Juergen Gross
2023-07-06  7:43     ` Jan Beulich
2023-07-06  7:57       ` Juergen Gross
2023-07-06  8:43         ` Jan Beulich
2023-07-06  9:10           ` Juergen Gross
2023-07-05 23:42   ` Stefano Stabellini
2023-07-05 15:26 ` [XEN PATCH v2 10/13] x86/monitor: " Simone Ballarin
2023-07-05 15:26 ` Simone Ballarin [this message]
2023-07-06  8:07   ` [XEN PATCH v2 11/13] xen/vpci: " Jan Beulich
2023-07-05 15:26 ` [XEN PATCH v2 12/13] xen/x86: " Simone Ballarin
2023-07-06  0:11   ` Stefano Stabellini
2023-07-06  8:26   ` Jan Beulich
2023-07-06 16:08     ` Simone Ballarin
2023-07-06 16:22       ` Jan Beulich
2023-07-07  6:50         ` Simone Ballarin
2023-07-07  7:04           ` Jan Beulich
2023-07-07  8:04             ` Simone Ballarin
2023-07-07  9:46               ` Jan Beulich
2023-07-07 21:53                 ` Stefano Stabellini
2023-07-10 16:09                   ` Simone Ballarin
2023-07-06 16:22       ` Jan Beulich
2023-07-05 15:26 ` [XEN PATCH v2 13/13] xen: " Simone Ballarin
2023-07-05 16:43   ` Luca Fancellu
2023-07-05 18:42     ` Simone Ballarin
2023-07-05 19:32       ` Simone Ballarin
2023-07-06  8:28         ` Jan Beulich
2023-07-05 23:49   ` Stefano Stabellini
2023-07-06  8:34     ` Jan Beulich
2023-07-06  8:40   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b4fad089f8fc85db19b33524ea6b14b1aef7cbb.1688559115.git.gianluca.luparini@bugseng.com \
    --to=simone.ballarin@bugseng.com \
    --cc=Xenia.Ragiadakou@amd.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=consulting@bugseng.com \
    --cc=gianluca.luparini@bugseng.com \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.