[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAPKFLCQRG3BTfqR22tc7YC1kQW-678Doxg8GY3D0rw_0y+0cCA@mail.gmail.com>
Date: Wed, 3 Sep 2025 22:19:19 +1000
From: Sebastian Ramadan <slay.sebbeh@...il.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 RFC 2/7] kfuzztest: add user-facing API and data structures
Hi Alexander,
Thanks for the patch.
One small note about the line calling kfuzztest_parse_and_relocate() —
specifically the use of (void **)&arg. This cast is technically
nonportable and invokes undefined behavior in C. The C standard
doesn't guarantee compatibility between different pointer-to-pointer
types, and this can lead to issues on architectures with stricter
aliasing or alignment requirements. While this may work on common
configurations, I'm curious to see the kernel realistically meet its
goals for wide support across diverse platforms.
To make this portable, you could use a temporary void * variable
instead. For example: declare void *tmp with initialisation (no cast
necessary there), pass &tmp to the function, and then assign arg = tmp
afterward. This avoids the cast and adheres to strict aliasing rules.
Alternatively, if the function is only ever used for a specific type,
changing its third argument to test_arg_type ** would also eliminate
the need for the cast and improve type safety. I'll leave it as an
exercise to the reader to find a way to bring anonymous tagged
struct/unions from C11 into the picture if that needs extension for
multiple types.
Thanks again, and hope this helps.
Best regards, Sebastian Ramadan.
Powered by blists - more mailing lists