* [PATCH] Documentation: Fix syntax of kmalloc_objs example in coding style doc
@ 2026-05-29 8:10 Uwe Kleine-König
2026-05-29 8:18 ` Geert Uytterhoeven
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2026-05-29 8:10 UTC (permalink / raw)
To: Jonathan Corbet, Manuel Ebner, Vlastimil Babka (SUSE),
SeongJae Park
Cc: Shuah Khan, workflows, linux-doc, linux-kernel
The first parameter should match the variable that the allocated memory
is assigned to. Fix the example accordingly, the one for kmalloc_obj got
it right already.
Fixes: 7c6d969d5349 ("Documentation: adopt new coding style of type-aware kmalloc-family")
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
---
Documentation/process/coding-style.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index a3bf75dc7c88..a8336582f60b 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -959,13 +959,13 @@ The preferred form for allocating an array is the following:
.. code-block:: c
- p = kmalloc_objs(*ptr, n, ...);
+ p = kmalloc_objs(*p, n, ...);
The preferred form for allocating a zeroed array is the following:
.. code-block:: c
- p = kzalloc_objs(*ptr, n, ...);
+ p = kzalloc_objs(*p, n, ...);
Both forms check for overflow on the allocation size n * sizeof(...),
and return NULL if that occurred.
base-commit: f7af91adc230aa99e23330ecf85bc9badd9780ad
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Documentation: Fix syntax of kmalloc_objs example in coding style doc
2026-05-29 8:10 [PATCH] Documentation: Fix syntax of kmalloc_objs example in coding style doc Uwe Kleine-König
@ 2026-05-29 8:18 ` Geert Uytterhoeven
2026-06-01 18:48 ` Jonathan Corbet
2026-06-01 20:08 ` Kees Cook
2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-05-29 8:18 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jonathan Corbet, Manuel Ebner, Vlastimil Babka (SUSE),
SeongJae Park, Shuah Khan, workflows, linux-doc, linux-kernel
On Fri, 29 May 2026 at 10:13, Uwe Kleine-König <ukleinek@kernel.org> wrote:
> The first parameter should match the variable that the allocated memory
> is assigned to. Fix the example accordingly, the one for kmalloc_obj got
> it right already.
>
> Fixes: 7c6d969d5349 ("Documentation: adopt new coding style of type-aware kmalloc-family")
> Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Documentation: Fix syntax of kmalloc_objs example in coding style doc
2026-05-29 8:10 [PATCH] Documentation: Fix syntax of kmalloc_objs example in coding style doc Uwe Kleine-König
2026-05-29 8:18 ` Geert Uytterhoeven
@ 2026-06-01 18:48 ` Jonathan Corbet
2026-06-01 20:08 ` Kees Cook
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Corbet @ 2026-06-01 18:48 UTC (permalink / raw)
To: Uwe Kleine-König, Manuel Ebner, Vlastimil Babka (SUSE),
SeongJae Park
Cc: Shuah Khan, workflows, linux-doc, linux-kernel
Uwe Kleine-König <ukleinek@kernel.org> writes:
> The first parameter should match the variable that the allocated memory
> is assigned to. Fix the example accordingly, the one for kmalloc_obj got
> it right already.
>
> Fixes: 7c6d969d5349 ("Documentation: adopt new coding style of type-aware kmalloc-family")
> Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
> ---
> Documentation/process/coding-style.rst | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
> index a3bf75dc7c88..a8336582f60b 100644
> --- a/Documentation/process/coding-style.rst
> +++ b/Documentation/process/coding-style.rst
> @@ -959,13 +959,13 @@ The preferred form for allocating an array is the following:
>
> .. code-block:: c
>
> - p = kmalloc_objs(*ptr, n, ...);
> + p = kmalloc_objs(*p, n, ...);
>
> The preferred form for allocating a zeroed array is the following:
>
> .. code-block:: c
>
> - p = kzalloc_objs(*ptr, n, ...);
> + p = kzalloc_objs(*p, n, ...);
>
> Both forms check for overflow on the allocation size n * sizeof(...),
> and return NULL if that occurred.
Applied, thanks.
jon
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Documentation: Fix syntax of kmalloc_objs example in coding style doc
2026-05-29 8:10 [PATCH] Documentation: Fix syntax of kmalloc_objs example in coding style doc Uwe Kleine-König
2026-05-29 8:18 ` Geert Uytterhoeven
2026-06-01 18:48 ` Jonathan Corbet
@ 2026-06-01 20:08 ` Kees Cook
2 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2026-06-01 20:08 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jonathan Corbet, Manuel Ebner, Vlastimil Babka (SUSE),
SeongJae Park, Shuah Khan, workflows, linux-doc, linux-kernel
On Fri, May 29, 2026 at 10:10:05AM +0200, Uwe Kleine-König wrote:
> The first parameter should match the variable that the allocated memory
> is assigned to. Fix the example accordingly, the one for kmalloc_obj got
> it right already.
>
> Fixes: 7c6d969d5349 ("Documentation: adopt new coding style of type-aware kmalloc-family")
> Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
oops, thank you!
Reviewed-by: Kees Cook <kees@kernel.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-01 20:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29 8:10 [PATCH] Documentation: Fix syntax of kmalloc_objs example in coding style doc Uwe Kleine-König
2026-05-29 8:18 ` Geert Uytterhoeven
2026-06-01 18:48 ` Jonathan Corbet
2026-06-01 20:08 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox