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

Re: [XEN PATCH v2] x86/HVM: address violations of MISRA C:2012 Rules 8.2 and 8.3



On 20/07/23 09:13, Jan Beulich wrote:
On 19.07.2023 15:52, Federico Serafini wrote:
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -559,17 +559,17 @@ static inline int from_bcd(RTCState *s, int a)
/* Hours in 12 hour mode are in 1-12 range, not 0-11.
   * So we need convert it before using it*/
-static inline int convert_hour(RTCState *s, int raw)
+static inline int convert_hour(RTCState *s, int hour)
  {
-    int hour = from_bcd(s, raw & 0x7f);
+    int ret = from_bcd(s, hour & 0x7f);
if (!(s->hw.cmos_data[RTC_REG_B] & RTC_24H))
      {
-        hour %= 12;
-        if (raw & 0x80)
-            hour += 12;
+        ret %= 12;
+        if (hour & 0x80)
+            ret += 12;
      }
-    return hour;
+    return ret;
  }

I've just sent an alternative correction for this.

Jan

I will send a v3 removing my changes to this function.

--
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)



 


Rackspace

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