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

Re: [XEN PATCH 1/6] x86: rename variable 'e820' to address MISRA C:2012 Rule 5.3


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 7 Aug 2023 17:07:35 +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=CtkciH7vevl+qXWFJGYHXABbC61JyYKo54rYVn7YO4w=; b=b+evAhIjHv95jHdPo2s1erVk9TUGWvHHS0kuTiB2ndfBSpaCaFAlbbF0XKpF00y+sCyQPXzWv74HDYSfJ9kgJHUXCkbtd+KVk6HELpS8wwsARb/ad0g5jfY8NIT7v5mNeLy8dQdDsHqvE5iK/+nRpCjk83QJu807PuJGWNR5qX4XFO5cLPWjlmGGvWV73RcLTrbaFwebV5V/jASf0WlBa0zwNGQDPI4HEse3f/FNOGKzuf0pE2urgZ7QJbHszB7yTVgl86qIXuu52lOJudtsc5d3HxbX1C55e1+NuJAIj4QSvIoxw4QkUoRv+38gh54ZrxuKv1vNB6geuwScRahx4Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gCj/hEMBUbZdEcIFLR2gFbHxlA91nkzH94BT2QMc2ILTyVlNG1czcOVTnEchlZYrR71nJ70teOEeMIzkpeKySjq3bCftyLAaByNTTvv61A/7QI8ZlYwD/Z1WyWyGFH4bQKQrMx1iHOsBLdayoeUG41YT1lzl9eslSrwOFK0vSIHT/pWEwWjByNc0pua0cdcyeXTRWZlDcUaf0zpEjv2mAVC06BNXYXez6U3wkwMmnYnQ7j1GlK188WzSSVyGwR6/z0+ocGs1B8gkxLwfsjwMZ84ggJAKrAIOBJYUCy3jMmd05Z12xl5MgE4bpRSmOQjhBJKBy0MQXZYgd1bf0Qj1Ww==
  • 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, 07 Aug 2023 15:08:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.08.2023 17:03, Nicola Vetrini wrote:
> On 07/08/2023 10:09, Jan Beulich wrote:
>> On 04.08.2023 17:27, Nicola Vetrini wrote:
>>> The variable declared in the header file 
>>> 'xen/arch/x86/include/asm/e820.h'
>>> is shadowed by many function parameters, so it is renamed to avoid 
>>> these
>>> violations.
>>>
>>> No functional changes.
>>>
>>> Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
>>> ---
>>> This patch is similar to other renames done on previous patches, and 
>>> the
>>> preferred strategy there was to rename the global variable. This one
>>> has more occurrences that are spread in various files, but
>>> the general pattern is the same.
>>
>> Still I think it would be better done the other way around, and perhaps 
>> in
>> more than a single patch. It looks like "many == 3", i.e.
>> - e820_add_range(), which is only ever called with "e820" as its 
>> argument,
>>   and hence the parameter could be dropped,
>> - e820_change_range_type(), which is in the same situation, and
>> - reserve_e820_ram(), which wants its parameter renamed.
> 
> This one is defined as
> 
> return e820_change_range_type(e820, s, e, E820_RAM, E820_RESERVED);
> 
> so I'm not certain that the parameter can be dropped from that function, 

You're right, it can't. I didn't pay enough attention on the interaction
of both. So renaming it is here then as well.

Jan

> because the cascade effect
> would eliminate the need to have a 'boot_e820' in 'xen/arch/x86/setup.c' 
> afaict and since the comment says
> 
> /* A temporary copy of the e820 map that we can mess with during 
> bootstrap. */
> static struct e820map __initdata boot_e820;
> 
> I'm not sure it's a good idea to alter this call chain.
> 




 


Rackspace

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