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: <1e3c4ee3-f66e-4ce0-819e-e0bed6a744e8@gmail.com>
Date: Mon, 21 Jul 2025 11:47:25 +0900
From: Akira Yokosawa <akiyks@...il.com>
To: carlos.bilbao@...nel.org
Cc: bilbao@...edu, corbet@....net, linux-doc@...r.kernel.org,
 linux-kernel@...r.kernel.org, David Howells <dhowells@...hat.com>,
 "Paul E. McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH] docs/core-api: Fix circular buffer examples

+CC David and Paul, who are the authors of this doc.

On Sun, 20 Jul 2025 11:02:43 -0500, Carlos Bilbao wrote:
> From: Carlos Bilbao <carlos.bilbao@...nel.org>
> 
> Fix circular buffer usage in producer/consumer examples in
> circular-buffers.rst. They incorrectly access items using buffer[head] and
> buffer[tail], as if buffer was a flat array; but the examples also use
> buffer->head and buffer->tail, so it's a struct. Use buffer->vals[head] and
> buffer->vals[tail] instead to match the intended layout.>
> 
> Signed-off-by: Carlos Bilbao <carlos.bilbao@...nel.org>
> ---
>  Documentation/core-api/circular-buffers.rst | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/core-api/circular-buffers.rst b/Documentation/core-api/circular-buffers.rst
> index 50966f66e398..b697915a2bd0 100644
> --- a/Documentation/core-api/circular-buffers.rst
> +++ b/Documentation/core-api/circular-buffers.rst
> @@ -161,7 +161,7 @@ The producer will look something like this::
>  
>  	if (CIRC_SPACE(head, tail, buffer->size) >= 1) {
>  		/* insert one item into the buffer */
> -		struct item *item = buffer[head];
> +		struct item *item = buffer->vals[head];
>  
>  		produce_item(item);
>  
> @@ -203,7 +203,7 @@ The consumer will look something like this::
>  	if (CIRC_CNT(head, tail, buffer->size) >= 1) {
>  
>  		/* extract one item from the buffer */
> -		struct item *item = buffer[tail];
> +		struct item *item = buffer->vals[tail];
>  
>  		consume_item(item);
>  
> -- 
> 2.43.0

        Thanks, Akira


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ