Re: [PATCH] x86/boot/e820: Re-enable fallback if e820 table is empty
From: David Gow
Date: Thu Apr 16 2026 - 03:08:35 EST
Le 15/04/2026 à 10:26 PM, Andy Shevchenko a écrit :
On Wed, Apr 15, 2026 at 09:50:32PM +0800, David Gow wrote:
Le 15/04/2026 à 4:51 PM, Andy Shevchenko a écrit :
On Wed, Apr 15, 2026 at 08:30:18AM +0800, David Gow wrote:
...
struct boot_e820_entry *entry = entries;
+ /* If there aren't any entries, we'll want to fall-back to another source. */
+ if (!nr_entries)
+ return -1;
Can we return -ENODATA or -ENOENT here?
Sounds like a good idea. The previous code (like this) used -1 for both
"there are no entires" and "there are entries which look bogus". Maybe we
should replace the latter with -EINVAL, too.
Maybe, but is it related to (coupled with) this change? If not, we can do it
later if needed.
I think it's probably related enough: append_e820_table() only has the one other error return. That being said, I don't think it matters too much either way: there's exactly one caller which checks the return value, and it only cares that it's nonzero. We could just replace the whole thing with a bool. (Or, if we wanted to be more brave, with the count of entries added, though that'd complicate the caller a bit if we wanted to preserve the same behaviour.)
Regardless, I've sent out v2 here:
https://lore.kernel.org/all/20260416065746.1896647-1-david@xxxxxxxxxxxx/
Cheers,
-- David