[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN PATCH v2 4/4] x86/setup: address MISRA C:2012 Rule 5.3
- To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 7 Aug 2023 15:05: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=A8uigQ/CapaG709BkamdJgc4DzMxFOjlVJzxKZz1Wtw=; b=kMh3MvoT4qEpqVeOQaymcfjpxRKQ0PzU3ziEnomoeKgVkEM/UuqWKyZU5xn34FV1J/P+PnReRPmrOppvxWqUEWRhkH+jYzbRXLxALiz2cwB1t3Tz/RcGl5e23IetFT/OHU5CGapo0ccZ2NcrfcaIPZ9dPO73zAvIBJHW1rKvxNmRGoCFFanWZ+p7VyqmUfnn0JehHcsbnSaQiU5BmLIn09brvYwL6nyAtVuNlpcSmqMqEa2zdWMV/qFRIfrsd3ssNMYuxNQTk1iy8AYbsWnvXsDNdWmzdF82b8bFUHwIi+ZFPJ+pJOdefKj/hV2odni38KzBbL8sYUXTa0v6qM2ZIw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WfHc6HxbYrVL+TcGDMnR1+BpJQ12D7q8wfDMRwNjFSxck841DTPtzkMxkLR0ziVwfiFS08N+Kt98kQ4FXQYDbTx3K5TiqKxp5y1N4rTkQxPDoD4csB3KgpWIGAkw2R60+FgCxwo0EbeXkvkGxNqNIi4U4Iy8I8m6sxZbycg2n8bB+aCzRnhypzIGu7VZsHDUyS85ZGizqcT6TasXE380xcNSMH8tEa4t69kMLBrf78klUesa6u0L/ctC7+aod5jtfJ3F+eqUBSMgxbNEiLtr1YytNQW+fBbmxjUJKjla6cMLxzTPsp9O4uPIZ9I9DXLCyM/RdeVgHMBy5yzm6csxpA==
- 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 13:06:05 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 04.08.2023 10:03, Nicola Vetrini wrote:
> The parameters renamed in the function declaration caused shadowing
> with the homonymous variable in 'xen/common/efi/boot.c'. Renaming
> them also addresses Rule 8.3:
> "All declarations of an object or function shall use the same names
> and type qualifiers".
Can you explain to me how shadowing can happen in a declaration? I
would focus on 8.3 here, and only mention the other name collision.
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -1577,8 +1577,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
> s = map_s;
> if ( s < map_e )
> {
> - uint64_t mask = (1UL << L2_PAGETABLE_SHIFT) - 1;
> -
> + mask = (1UL << L2_PAGETABLE_SHIFT) - 1;
> map_s = (s + mask) & ~mask;
> map_e &= ~mask;
> init_boot_pages(map_s, map_e);
Re-using the outer scope variable is a little risky, don't you agree?
It just so happens that below here there's no further use requiring
the earlier value (PAGE_SIZE - 1). This isn't to say I'm opposed, but
it certainly needs evaluating with this in mind (mentioning of which
in the description would have demonstrated that you did consider this
aspect).
Jan
|