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

[xen master] common/softirq: address violation of MISRA C Rule 13.6



commit daff80607a2e2e04578057bf66b0ef2a43864c4c
Author:     Alessandro Zucchelli <alessandro.zucchelli@xxxxxxxxxxx>
AuthorDate: Tue Jul 23 14:00:27 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jul 23 14:00:27 2024 +0200

    common/softirq: address violation of MISRA C Rule 13.6
    
    In the file common/softirq macro set_bit is called with argument
    smp_processor_id.
    Once expanded this set_bit's argument is used in sizeof operations
    and thus 'smp_processor_id', being a macro that may expand to a
    function call with potential side effects, generates a violation.
    
    To address this violation the value of smp_processor_id is therefore
    stored in a variable called 'cpu' 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/common/softirq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/common/softirq.c b/xen/common/softirq.c
index bee4a82009..60f344e842 100644
--- a/xen/common/softirq.c
+++ b/xen/common/softirq.c
@@ -139,7 +139,9 @@ void cpu_raise_softirq_batch_finish(void)
 
 void raise_softirq(unsigned int nr)
 {
-    set_bit(nr, &softirq_pending(smp_processor_id()));
+    unsigned int cpu = smp_processor_id();
+
+    set_bit(nr, &softirq_pending(cpu));
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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