Re: [PATCH v2 1/2] x86: Check return values from early_memremap calls

From: Borislav Petkov
Date: Wed Jan 04 2023 - 06:58:58 EST


On Thu, Nov 10, 2022 at 08:07:53AM -0800, Dave Hansen wrote:
> On 11/10/22 07:45, Ross Philipson wrote:
> > dt = early_memremap(initial_dtb, map_len);
> > + if (!dt) {
> > + pr_warn("failed to memremap initial dtb\n");
> > + return;
> > + }
>
> Are all of these new pr_warn/err()'s really adding much value? They all
> look pretty generic. It makes me wonder if we should just spit out a
> generic message in early_memremap() and save all the callers the trouble.

Well, let's see.

early_memremap() calls __early_ioremap() and that one already warns befofe each
NULL return. So I guess we don't need the error messages as we will know where
it starts failing.

I guess we still need the error handling though.

I.e., this above should be:

dt = early_memremap(initial_dtb, map_len);
+ if (!dt)
+ return;

so that we don't go off into the weeds with a NULL ptr.

Or?

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette