All of lore.kernel.org
 help / color / mirror / Atom feed
* [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS
@ 2023-09-05  7:31 Nicola Vetrini
  2023-09-05  7:46 ` Jan Beulich
  2023-10-04 13:23 ` Nicola Vetrini
  0 siblings, 2 replies; 21+ messages in thread
From: Nicola Vetrini @ 2023-09-05  7:31 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, michal.orzel, xenia.ragiadakou, ayan.kumar.halder,
	consulting, Nicola Vetrini, Andrew Cooper, George Dunlap,
	Jan Beulich, Julien Grall, Wei Liu

Given its use in the declaration
'DECLARE_BITMAP(features, IOMMU_FEAT_count)' the argument
'bits' has essential type 'enum iommu_feature', which is not
allowed by the Rule as an operand to the addition operator.
Given that its value can be represented by a signed integer,
the explicit cast resolves the violation.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
 xen/include/xen/types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index aea259db1ef2..2ff8f243908d 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -23,7 +23,7 @@ typedef signed long ssize_t;
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
 
 #define BITS_TO_LONGS(bits) \
-    (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
+    (((int)(bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
 #define DECLARE_BITMAP(name,bits) \
     unsigned long name[BITS_TO_LONGS(bits)]
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-10-16 10:31 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-05  7:31 [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS Nicola Vetrini
2023-09-05  7:46 ` Jan Beulich
2023-09-05  8:20   ` Nicola Vetrini
2023-09-05  8:33     ` Jan Beulich
2023-09-06 15:57       ` Nicola Vetrini
2023-09-06 16:02         ` Jan Beulich
2023-09-07  1:33           ` Stefano Stabellini
2023-09-07  6:42             ` Jan Beulich
2023-09-08  8:48             ` Nicola Vetrini
2023-09-08 11:57               ` Jan Beulich
2023-09-08 11:59                 ` Jan Beulich
2023-09-08 14:53                   ` Nicola Vetrini
2023-09-08 15:09                     ` Nicola Vetrini
2023-09-11  6:43                       ` Jan Beulich
2023-09-08 19:37                     ` Stefano Stabellini
2023-09-19  9:19                       ` Nicola Vetrini
2023-09-19  9:33                         ` Jan Beulich
2023-09-19  9:54                           ` Nicola Vetrini
2023-09-19  9:59                             ` Jan Beulich
2023-10-04 13:23 ` Nicola Vetrini
2023-10-16 10:31   ` Jan Beulich

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.