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

Re: [PATCH] xen/arm: mark handle_linux_pci_domain() __init


  • To: Julien Grall <julien@xxxxxxx>, Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 17 Oct 2022 08:18: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=4UI+Td8eue2PWUl764XmnwIdpSUjsrLQmd+fwdyuvZg=; b=hSqyMB5U2aTjdN3z7M8F0EMj6pRSGgglR68Manes91s97k2bEi+lfNM+C5V6un11DPQTgfHXkRGFCx0I8zi622k0krEhCmbaTBf1KHmVWO2CWJIYj1uDwcHH/QjGJYahRhqInyaMyW4ZdOa+bDc0ZukvPGDbXWvRr91d34vvjaz4whuViVroQT8y5jb3tticO+Dkshm9wvcapnZZ1iVY0k9bSOzKf7c9twdWhdrTxzW34cvYOBGcKJFFpff1u7rxRvjbS41UectPoFy4LFLPMSNR10dM6VtPSM7mHRb+Zklg866HOJaIN5Aj6rAkJt3w6BiKffS247fLvyL7SWzkUg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KR3AUdNVKShookLBErG2y1EAb7rySwLnw/uQCjAHjWtfvvh8SX3hQtev+r9PKHZKK4DI50+TJlXfRjA7xXG0vgl9fzcDpc4gaSgEJ6ppzJBcJuCWZw4fd3DiWUWvmODLYfffzsqbf8UCYqKhn+dMlSrvMDeHScd3fTKXRJLqTtKebOdpnAfehjzDxU16acIGORXUqCVjGep/A+0RTJnhXYnjFZelEfa5p4K8Cb5t1xL5CnbPa07HarPDHwGlLAH1oiBhLvPH18hIi1sngzHzeHNuTEc7PugeIygrDkVCXxYDXB2ZbU+obKeik5MRtssrC5aSLLG1uUjlKh28TCi2GA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 17 Oct 2022 06:18:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.10.2022 22:15, Julien Grall wrote:
> On 14/10/2022 20:23, Stewart Hildebrand wrote:
>> arch/arm/efi/boot.c: In function ‘efi_start’:
>> arch/arm/efi/boot.c:1464:9: error: ‘argc’ may be used uninitialized in 
>> this function [-Werror=maybe-uninitialized]
>>   1464 |         efi_arch_handle_cmdline(argc ? *argv : NULL, options, 
>> name.s);
>>        | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> I am a bit puzzled why it warn on this line but not few lines above 
> where it is already used.

Same here. Plus it ought to warn for argv then too, I think.

> This function is a bit difficult to read. AFAIU, the code look like:
> 
> if ( use_cfg_file )
> {
>     argc = ...
> }
> 
> /* do something common */
> 
> if ( use_cfg_file )
>    efi_arch_handle_cmd(argc, ...);
> 
> The GCC with -Og is probably not capable to detect that argc will always 
> be used when 'use_cfg_file'.
> 
> The "do something common" is two lines. So I am tempted to suggest to 
> just duplicate those two lines. This could also allow us to move all the 
> code in the ifs (nearly 100 lines over the two ifs!) in a separate function.
> 
> But I think Jan (the maintainer of the code) may not be happy with 
> that).

Indeed. Even if it's only two statements now, my view is that we ought to
avoid such code duplication.

Further I wonder whether the call to efi_check_dt_boot() shouldn't
actually live in an "else" to the 2nd if(). It would be at least
questionable if parts of the modules were described by the .cfg file and
other parts by DT (which in turn makes assumptions about the relative
placement of those modules wrt xen.efi on the EFI partition, when I'd
expect it to be self-contained).

> So short of a second better suggestion, initializing 'argc' to 0 
> (?) and a comment explaining this is to silence the compiler may be the 
> way to go.

I'd prefer if we avoided that, not the least because this could then trip
(good) static checkers to report written-but-never-used instances. What I
might accept (albeit that doesn't address said concern) is an "else" to
the first if() setting argc and argv (accompanied by a suitable comment,
down the road perhaps including a SAF-<nnn>-false-positive marker).

Jan



 


Rackspace

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