[PATCH v2 3/3] docs/devel/style: Mention alloca() family API is forbidden

Philippe Mathieu-Daudé posted 3 patches 3 weeks, 6 days ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, Markus Armbruster <armbru@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Chinmay Rath <rathc@linux.ibm.com>
[PATCH v2 3/3] docs/devel/style: Mention alloca() family API is forbidden
Posted by Philippe Mathieu-Daudé 3 weeks, 6 days ago
Suggested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 docs/devel/style.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/devel/style.rst b/docs/devel/style.rst
index d025933808e..941fe14bfd4 100644
--- a/docs/devel/style.rst
+++ b/docs/devel/style.rst
@@ -446,8 +446,8 @@ Low level memory management
 ===========================
 
 Use of the ``malloc/free/realloc/calloc/valloc/memalign/posix_memalign``
-APIs is not allowed in the QEMU codebase. Instead of these routines,
-use the GLib memory allocation routines
+or ``alloca/g_alloca/g_newa/g_newa0`` APIs is not allowed in the QEMU codebase.
+Instead of these routines, use the GLib memory allocation routines
 ``g_malloc/g_malloc0/g_new/g_new0/g_realloc/g_free``
 or QEMU's ``qemu_memalign/qemu_blockalign/qemu_vfree`` APIs.
 
-- 
2.51.0


Re: [PATCH v2 3/3] docs/devel/style: Mention alloca() family API is forbidden
Posted by Stefan Hajnoczi 3 weeks, 5 days ago
On Mon, Sep 01, 2025 at 03:26:26PM +0200, Philippe Mathieu-Daudé wrote:
> Suggested-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  docs/devel/style.rst | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Re: [PATCH v2 3/3] docs/devel/style: Mention alloca() family API is forbidden
Posted by Manos Pitsidianakis 3 weeks, 6 days ago
On Mon, Sep 1, 2025 at 4:27 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Suggested-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

>  docs/devel/style.rst | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/docs/devel/style.rst b/docs/devel/style.rst
> index d025933808e..941fe14bfd4 100644
> --- a/docs/devel/style.rst
> +++ b/docs/devel/style.rst
> @@ -446,8 +446,8 @@ Low level memory management
>  ===========================
>
>  Use of the ``malloc/free/realloc/calloc/valloc/memalign/posix_memalign``
> -APIs is not allowed in the QEMU codebase. Instead of these routines,
> -use the GLib memory allocation routines
> +or ``alloca/g_alloca/g_newa/g_newa0`` APIs is not allowed in the QEMU codebase.
> +Instead of these routines, use the GLib memory allocation routines
>  ``g_malloc/g_malloc0/g_new/g_new0/g_realloc/g_free``
>  or QEMU's ``qemu_memalign/qemu_blockalign/qemu_vfree`` APIs.
>
> --

If you wanna dust off your perl, you could also add this to checkpatch.pl :)
Re: [PATCH v2 3/3] docs/devel/style: Mention alloca() family API is forbidden
Posted by Philippe Mathieu-Daudé 3 weeks, 6 days ago
On 1/9/25 16:05, Manos Pitsidianakis wrote:
> On Mon, Sep 1, 2025 at 4:27 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Suggested-by: Alex Bennée <alex.bennee@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
> 
> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> 
>>   docs/devel/style.rst | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/docs/devel/style.rst b/docs/devel/style.rst
>> index d025933808e..941fe14bfd4 100644
>> --- a/docs/devel/style.rst
>> +++ b/docs/devel/style.rst
>> @@ -446,8 +446,8 @@ Low level memory management
>>   ===========================
>>
>>   Use of the ``malloc/free/realloc/calloc/valloc/memalign/posix_memalign``
>> -APIs is not allowed in the QEMU codebase. Instead of these routines,
>> -use the GLib memory allocation routines
>> +or ``alloca/g_alloca/g_newa/g_newa0`` APIs is not allowed in the QEMU codebase.
>> +Instead of these routines, use the GLib memory allocation routines
>>   ``g_malloc/g_malloc0/g_new/g_new0/g_realloc/g_free``
>>   or QEMU's ``qemu_memalign/qemu_blockalign/qemu_vfree`` APIs.
>>
>> --
> 
> If you wanna dust off your perl, you could also add this to checkpatch.pl :)

We expect contributors to test their patches before posting :P
(normally it shouldn't build due to -Walloca in the previous patch)

Thanks!