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

Re: [XEN PATCH v2 1/4] x86: mechanically rename to address MISRA C:2012 Rule 5.3


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 31 Jul 2023 13:21:49 +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=h51W8AFPnEmtnFCwCyouES4Oqa3SJaYrWkAAk2V3AGQ=; b=VLnGSAGvhAi+GZpGO7bmOoxJ4C/qddLWbHeeNMs5LVVVx5ATRkEd6VqEsiqFgmKmrwGxkCUzfsmZftk8CFHyRBofXttr7+oJRZQV4ogXbSHYaXsLaYLrLMXKDH0XH/QBfX5cuTciblisqgP1Et+3STdTMlVl2WGCENs8tAfSxvOYgwCshmB8qwuedXoRavrBRVx8A6F4qCc2ZZBCV6phsw5NGm4LjKqxMV+KZe6rKJhxoRwbE9xNwd8IbxdhvYhVFNZhPy9T/m5J1i7jgRwoATRttE5+b7+t0wZZTnt3IsEvV8OQBcvZMkrm0acN9inQcp6q39lomQX0LEI5Dconig==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ePI16BBlHbrvmcsVPXHsnMGDhW9Z3G3WQgVpLeeSAge2kNqvHMaSbJ31k0uCxFAU8YXySLnOGvaP7VWm0y0Oc6jRtY4U6xmxVpn5NSBRlpCRrumbZCqpMmtakmdPKa8/6al5vkMsdQHgOBCZR+I7H3QqjBRfiLlgQkm/uJNcDu1eUs1CIr4wzQDqzlNA4NAim7+bRqaN5BTrjvBj8E4owoiEMnfEeQE1enV3hFp/TGqxKMZByxZPW2IVSGMz6bTT0JDlYHXJ3D+sQq1q8uJ21PK2FGPDjgHWE25p4C5MImf7zvXO2pB321g8MwDzKcsWEp6ftPsEhZhWrl2/B3O/rw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 31 Jul 2023 11:22:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 31.07.2023 13:15, Jan Beulich wrote:
> On 31.07.2023 09:33, Nicola Vetrini wrote:
>> --- a/xen/arch/x86/include/asm/hvm/save.h
>> +++ b/xen/arch/x86/include/asm/hvm/save.h
>> @@ -49,21 +49,21 @@ void _hvm_read_entry(struct hvm_domain_context *h,
>>   */
>>  #define _hvm_load_entry(_x, _h, _dst, _strict) ({                       \
>>      int r;                                                              \
>> -    struct hvm_save_descriptor *desc                                    \
>> +    struct hvm_save_descriptor *descriptor                              \
>>          = (struct hvm_save_descriptor *)&(_h)->data[(_h)->cur];         \
>>      if ( (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x),                 \
>>                 HVM_SAVE_LENGTH(_x), (_strict))) == 0 )                  \
>>      {                                                                   \
>>          _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH(_x));             \
>>          if ( HVM_SAVE_HAS_COMPAT(_x) &&                                 \
>> -             desc->length != HVM_SAVE_LENGTH(_x) )                      \
>> -            r = HVM_SAVE_FIX_COMPAT(_x, (_dst), desc->length);          \
>> +             descriptor->length != HVM_SAVE_LENGTH(_x) )                \
>> +            r = HVM_SAVE_FIX_COMPAT(_x, (_dst), descriptor->length);    \
>>      }                                                                   \
>>      else if (HVM_SAVE_HAS_COMPAT(_x)                                    \
>>               && (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x),          \
>>                         HVM_SAVE_LENGTH_COMPAT(_x), (_strict))) == 0 ) { \
>>          _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH_COMPAT(_x));      \
>> -        r = HVM_SAVE_FIX_COMPAT(_x, (_dst), desc->length);              \
>> +        r = HVM_SAVE_FIX_COMPAT(_x, (_dst), descriptor->length);        \
>>      }                                                                   \
>>      r; })
> 
> The macro-local variable gets too long for my taste, to be honest,
> and it being improperly named anyway suggests it simply wants a
> trailing underscore added. And then, since for a variable named "r"
> the risk of shadowing is equally high, that one wants to gain a
> trailing underscore as well imo. (And while at it, I personally
> would also drop the leading underscores from the macro parameter
> names. Furthermore I think it would be nice if at on the lines
> touched anyway indentation was also corrected. Overall maybe best
> if I submit a patch.)

In that replacement patch I would like to mention what "desc" this
collides with, but your description didn't say so and I'm afraid I
also haven't been able to spot it (grep-ing for "desc", even with
a couple of extra restrictions, still yields way too many hits).

Jan



 


Rackspace

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