|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xen/event: address violation of MISRA C Rule 13.6
commit 04c031d9a10e99bdcdb736d4c84454b9c79d1144
Author: Alessandro Zucchelli <alessandro.zucchelli@xxxxxxxxxxx>
AuthorDate: Tue Jun 25 12:14:20 2024 +0200
Commit: Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Tue Jul 30 15:14:31 2024 -0700
xen/event: address violation of MISRA C Rule 13.6
In the file include/xen/event.h macro set_bit is called with argument
current->pause_flags.
Once expanded this set_bit's argument is used in sizeof operations
and thus 'current', being a macro that expands to a function
call with potential side effects, generates a violation.
To address this violation the value of current is therefore stored in a
variable called 'v' before passing it to macro set_bit.
No functional change.
Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@xxxxxxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
xen/include/xen/event.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index f1472ea1eb..48b79f3d62 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -183,13 +183,14 @@ static bool evtchn_usable(const struct evtchn *evtchn)
/* Wait on a Xen-attached event channel. */
#define wait_on_xen_event_channel(port, condition) \
do { \
+ struct vcpu *v = current; \
if ( condition ) \
break; \
- set_bit(_VPF_blocked_in_xen, ¤t->pause_flags); \
+ set_bit(_VPF_blocked_in_xen, &v->pause_flags); \
smp_mb(); /* set blocked status /then/ re-evaluate condition */ \
if ( condition ) \
{ \
- clear_bit(_VPF_blocked_in_xen, ¤t->pause_flags); \
+ clear_bit(_VPF_blocked_in_xen, &v->pause_flags); \
break; \
} \
raise_softirq(SCHEDULE_SOFTIRQ); \
@@ -198,7 +199,8 @@ static bool evtchn_usable(const struct evtchn *evtchn)
#define prepare_wait_on_xen_event_channel(port) \
do { \
- set_bit(_VPF_blocked_in_xen, ¤t->pause_flags); \
+ struct vcpu *v = current; \
+ set_bit(_VPF_blocked_in_xen, &v->pause_flags); \
raise_softirq(SCHEDULE_SOFTIRQ); \
smp_mb(); /* set blocked status /then/ caller does his work */ \
} while ( 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |