ACK/Cmnt: [SRU][J/N/Q/R:Unstable][PATCH 0/1] efi: Fix swapped bsearch arguments in SAUCE patch

Stefan Bader stefan.bader at canonical.com
Wed Mar 4 09:10:35 UTC 2026


On 10/02/2026 06:14, Dongdong Tao wrote:
> BugLink: https://bugs.launchpad.net/bugs/2141276
> 
> == SRU Justification ==
> 
> [Impact]
> The SAUCE patch "UBUNTU: SAUCE: (lockdown) Add efi_status_to_str() and
> rework efi_status_to_err()" contains a bug where the 3rd and 4th arguments
> to bsearch() are swapped.
> 
> The bsearch() signature is:
>    void *bsearch(key, base, nmemb, size, compar)
> 
> Current code passes: (sizeof(struct efi_error_code), num) -- WRONG
> Should be:           (num, sizeof(struct efi_error_code)) -- CORRECT
> 
> This causes bsearch to calculate incorrect element offsets:
> - Buggy:   thinks 24 elements of 12 bytes each
> - Correct: should be 12 elements of 24 bytes each
> 
> This may cause efi_status_to_err() and efi_status_to_str() to return
> incorrect error codes or fail to find valid status codes.
> 
> [Test Plan]
> 1. Boot system with EFI firmware
> 2. Trigger EFI error conditions (e.g., secure boot violations)
> 3. Verify correct error messages are displayed
> 4. Check dmesg for proper EFI status code translations
> 
> [Where problems could occur]
> The fix is a straightforward argument swap with no functional changes.
> Risk is minimal as this corrects the code to match the documented
> bsearch() API.
> 
> [Other]
> This fix has been merged upstream in kernel-ark:
> https://gitlab.com/cki-project/kernel-ark/-/commit/49bcc48074ba
> 
> Dongdong Tao (1):
>    UBUNTU: SAUCE: efi: Fix swapped arguments to bsearch() in
>      efi_status_to_*()
> 
>   drivers/firmware/efi/efi.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --
> 2.39.5
> 

I believe this kind of changes have a history of being "special". The 
change itself looks reasonable and we should adjust the s-o-b area as it 
seems appropriate when applying.

Acked-by: Stefan Bader <stefan.bader at canonical.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xE8675DEECBEECEA3.asc
Type: application/pgp-keys
Size: 52669 bytes
Desc: OpenPGP public key
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20260304/d778b088/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20260304/d778b088/attachment-0001.sig>


More information about the kernel-team mailing list