[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


  • To: Federico Serafini <federico.serafini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 20 Jul 2023 09:13:13 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rSOexzgjdj3jGYtL4tQirhvoCQIqOI32M5rUFJgXD9Q=; b=lo/8IcqD/cqyZP6lde4cTdJVoZMjHiubm1Nbg7bXIgluMkxdruMAOTTFHUDgY/D1oPgcRbrfoveWKHAdkHGobssBPaXcUY6x6nQOBrgDIhP1E+bCnGYZjfmh6m2iOSZdK1WWPldl94PBiVCPNJSeepoH5l7ryPuOs3I9ESqAIYBAH8B1xEBCFWFiizl1P7zR5itZIP+DsKe87q6M0kQoNVOplLsbCznVRyp94xCHld/wSdY+0E8swa+xoDj1IdvWkUlsknRM6dxM+hHcdy7tVcmWx193RfOg7+nBbfDo6fRtXwMyG4Kigi9aVqADwwtIKOq+kDYyvT7FeBXGrC6hGg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BjCOn6IEB0ARLj0fkx45+oh6eC5r1HnuK2WUigGpdlTCbdp6aYI8Ee7jG1zMsrrk3qbdVVkHfkn+ek9AxYxI5P1E0PNKL3h9nceyaw6CxaIBBVLDB2Ktp+f91ViI7lfShfJTNlB14eEvVLQvRZDch20Es8jJZ25BCUnYeHLQqFWVOGBQa1FRYUNGxTkcFzRv5IBLDGDz8NKe6OKUVUKRmB7sbt4XDepeunQkXKWBoch26nrLhyDZzmUFyqprc+kkK8B+LBnAQ0FyGAZF3sygF+55O/C56TpS6957xBkqrecrG+gFH5HR0A7q/CAxVk2c8ZgAYsS7KgjxwbXxfO2Cdw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 20 Jul 2023 07:13:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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



 


Rackspace

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