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: <3951551f-02e9-41a3-8212-ac1cbaecc69a@kernel.org>
Date: Mon, 10 Nov 2025 08:32:08 +0000
From: Srinivas Kandagatla <srini@...nel.org>
To: Emil Renner Berthing <emil.renner.berthing@...onical.com>,
 linux-kernel@...r.kernel.org
Cc: Srinivas Kandagatla <srini@...nel.org>,
 Samuel Holland <samuel@...lland.org>, Dmitry Baryshkov <lumag@...nel.org>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v1] nvmem: core: update cell->bytes after shifting bits



On 9/30/25 3:22 PM, Emil Renner Berthing wrote:
> When support for bit offsets of more than one byte was added it
> unfortunately left the cell->bytes value at the number of bytes read
> including the offset. Make sure to update it to the proper number of
> meaningful bytes in the returned data.
Sorry somehow I missed this patch.

If the number of bytes are different to the bytes that are part of cell
then the parsing code seems to have missed some cases, which is the
right place to fix.

Can you share more details on the values that you pass as part of the
cell definition.

> Fixes: 7a06ef751077 ("nvmem: core: fix bit offsets of more than one byte")

missing CC stable

> Signed-off-by: Emil Renner Berthing <emil.renner.berthing@...onical.com>
> ---
>  drivers/nvmem/core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 387c88c55259..5f6d22545e39 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -1640,6 +1640,8 @@ static void nvmem_shift_read_buffer_in_place(struct nvmem_cell_entry *cell, void
>  	/* clear msb bits if any leftover in the last byte */
>  	if (cell->nbits % BITS_PER_BYTE)
>  		*p &= GENMASK((cell->nbits % BITS_PER_BYTE) - 1, 0);
> +
> +	cell->bytes = (p - (u8 *)buf) + 1;
cell bytes can only be updated during parsing time not during every
access time.


--srini>  }
>  
>  static int __nvmem_cell_read(struct nvmem_device *nvmem,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ