lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMj1kXFCzM4wTJQe13_BYEe5W_35=+UWwzzpUK8Jt-bOgWGFCg@mail.gmail.com>
Date: Wed, 14 Jan 2026 11:33:58 +0100
From: Ard Biesheuvel <ardb@...nel.org>
To: Morduan Zang <zhangdandan@...ontech.com>
Cc: linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org, 
	guanwentao@...ontech.com, niecheng1@...ontech.com
Subject: Re: [PATCH] efi/cper: Fix cper_bits_to_str buffer handling and return value

On Wed, 14 Jan 2026 at 06:32, Morduan Zang <zhangdandan@...ontech.com> wrote:
>
> The return value calculation was incorrect:
>     `return len - buf_size;`
>     Initially `len = buf_size`, then `len` decreases with each operation.
>     This results in a negative return value on success.
>
> Fix by returning `buf_size - len` which correctly calculates the
>     actual number of bytes written.
>
> Fixes: a976d790f494 ("efi/cper: Add a new helper function to print bitmasks")
> Signed-off-by: Morduan Zang <zhangdandan@...ontech.com>
> ---
>  drivers/firmware/efi/cper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
> index 0232bd040f61..bd99802cb0ca 100644
> --- a/drivers/firmware/efi/cper.c
> +++ b/drivers/firmware/efi/cper.c
> @@ -162,7 +162,7 @@ int cper_bits_to_str(char *buf, int buf_size, unsigned long bits,
>                 len -= size;
>                 str += size;
>         }
> -       return len - buf_size;
> +       return buf_size - len;
>  }
>  EXPORT_SYMBOL_GPL(cper_bits_to_str);
>

Thanks for the fix. Queued up in efi/urgent.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ