[PATCH v2 2/2] ARM: move device tree mapping out of linear region

Nicolas Pitre nico at fluxnic.net
Wed Oct 7 18:05:42 EDT 2020


On Wed, 7 Oct 2020, Russell King - ARM Linux admin wrote:

> On Wed, Oct 07, 2020 at 11:28:03AM -0400, Nicolas Pitre wrote:
> > On Wed, 7 Oct 2020, Ard Biesheuvel wrote:
> > 
> > > @@ -1078,13 +1078,18 @@ void __init hyp_mode_check(void)
> > >  void __init setup_arch(char **cmdline_p)
> > >  {
> > >  	const struct machine_desc *mdesc = NULL;
> > > +	void *atags_vaddr;
> > >  
> > >  	if (__atags_pointer)
> > > -		atags_vaddr = phys_to_virt(__atags_pointer);
> > > +		atags_vaddr = FDT_VIRT_ADDR(__atags_pointer);
> > >  
> > >  	setup_processor();
> > > -	if (atags_vaddr)
> > > +	if (atags_vaddr) {
> > >  		mdesc = setup_machine_fdt(atags_vaddr);
> > 
> > If __atags_pointer is zero, you'll end up with atags_vaddr being 
> > undefined here. I'm surprised the compiler didn't warn about that.
> 
> The warning has been disabled. See commit
> 78a5255ffb6a1af189a83e493d916ba1c54d8c75.

Hmmm... that's nasty.  I guess we'll have to get into the habit of 
test-compiling our patches with W=2 then, at least for catching the 
obvious ones like this case. Someone should automate that into 
checkpatch or the like.


Nicolas



More information about the linux-arm-kernel mailing list