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

Re: [XEN PATCH] 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: Wed, 19 Jul 2023 13:48:39 +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=1zy9RzLqtfWBRjBZjD/nbrzMKbpV68sk/06K6TEQtmg=; b=CrW1MCRt5Qv5ABNnQXedPJ/sniHRmc/bpXzZS8/MB/RiM4sIbJK47Af/azYDEetcSOqlGp2iZgh+LZFEoO79q91lrDf9DJlXZBEVlezQC/fEwQZWzvv5NjRUuXQebYqbz0jUKfiWX9g5pv53J+p0XxpSO24JQPtu9UF3zXGd3jazLTSxFnvYT3zFLv+XSuFkH9AB2ZtsXxe3HQzOw1q6bK+Qxs+rT2aTRgE54U+ghw/gnY34AxnzyWMOOzePHJSmceCwO0Dzykg/4M8siZje9Cx/wq73E7bFqAnyP/blKpnHGCyYhABXLj9fFD2VWrZekeRIYX4B4fEvYj5bDMfLmA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RgHl594OUGt86eFuEvhpSRAY6pJi1a3DUN/oigIA+87u5XxnYrpWZ11ATpyxFu/tRHsageLlo9d2Rtz+spmKV5nO7JtgJXDEtos3S0jeCEmSS41M8YWWrXNydJVdQhcIuEck//dX7r4gDqaxVDw1l0Odba93eua15S+uIO96kOMI1AiKteerui2JgqSk0qT/7FPaswtI6Uiz4vxqAk1HRc8lBUMoWFQVodnlbd/0wOwpzugj5xetS0o7Xpiy5Q5Ijz/WxuXTYGUzCmmoQnrxWsoHsEdhHdmMAzFwlmTDFlxpnbahg+mh6Ia4+Jb7wg7wjWY2+NwAy+ozTdmotQE6Sw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: consulting@xxxxxxxxxxx, 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>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 19 Jul 2023 11:49:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.07.2023 12:38, Federico Serafini wrote:
> On 19/07/23 12:23, Andrew Cooper wrote:
>> On 19/07/2023 11:07 am, Federico Serafini wrote:
>>> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
>>> index 57363c2ae1..8f19a79f6f 100644
>>> --- a/xen/arch/x86/hvm/hvm.c
>>> +++ b/xen/arch/x86/hvm/hvm.c
>>> @@ -319,7 +319,7 @@ static bool pat_valid(uint64_t val)
>>>       return !(any_gt_7 | any_2_or_3);
>>>   }
>>>   
>>> -int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
>>> +int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat)
>>
>> If there's a u64 vs uint64_t mismatch (or others for that matter),
>> resolve in the way of the stdint types.  That way you're correcting in
>> the direction of the Xen coding style, rather than away from it.
> 
> Changing the type in the declaration from u64 to uint64_t
> touching hvm.h will lead to inconsistencies with adjacent declarations.
> In such cases, should I propagate the change to the adjacent ones
> as well?

Preferably yes, I would say, but I wouldn't make this a hard requirement.
The decls have a pretty bad mix anyway. One thing though: You also fiddle
with hvm_get_guest_tsc_fixed(), and there please also convert the return
type then.

Jan



 


Rackspace

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