|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v1 2/3] compat: address violations of MISRA C Rule 19.1
From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
Rule 19.1 states: "An object shall not be assigned or copied
to an overlapping object". Since the "call" and "compat_call" are
fields of the same union, reading from one member and writing to
the other violates the rule, while not causing Undefined Behavior
due to their relative sizes. However, a dummy variable is used to
address the violation and prevent the future possibility of
incurring in UB.
No functional change.
Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
Signed-off-by: Victor Lira <victorm.lira@xxxxxxx>
---
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Cc: Michal Orzel <michal.orzel@xxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Julien Grall <julien@xxxxxxx>
Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
Cc: Federico Serafini <federico.serafini@xxxxxxxxxxx>
Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
xen/common/compat/multicall.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/xen/common/compat/multicall.c b/xen/common/compat/multicall.c
index b17739d218..1740fb2172 100644
--- a/xen/common/compat/multicall.c
+++ b/xen/common/compat/multicall.c
@@ -15,8 +15,13 @@ typedef int ret_t;
static inline void xlat_multicall_entry(struct mc_state *mcs)
{
int i;
+ xen_ulong_t arg;
+
for (i=0; i<6; i++)
- mcs->compat_call.args[i] = mcs->call.args[i];
+ {
+ arg = mcs->call.args[i];
+ mcs->compat_call.args[i] = arg;
+ }
}
#define multicall_entry compat_multicall_entry
--
2.47.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |