Re: [DTrace-devel] [PATCH 5/6] Possible uninitialized 'last' variable in usdt_copyin_data()

Nick Alcock <[email protected]> Tue, 14 Apr 2026 22:43:11 +0100
Newsgroups dev.linux.lists.dtrace
Message-ID <[email protected]>
On 31 Mar 2026, eugene loh told this:

> From: Eugene Loh <[email protected]>
>
> Some compilers warn:
>
> libcommon/usdt_parser.c: In function =E2=80=98usdt_copyin_data=E2=80=99:
> libcommon/usdt_parser.c:191:15: warning:
>    =E2=80=98last=E2=80=99 may be used uninitialized in this function [-Wm=
aybe-uninitialized]
>     last->next =3D blk;
>     ~~~~~~~~~~~^~~~~
>
> Change the "if" check to make it easier for compilers to recognize
> that "last" will be initialized (and non-NULL even!).
>
> Signed-off-by: Eugene Loh <[email protected]>

Ugh. Still, if it works, it works, and it's semantically the same.

Reviewed-by: Nick Alcock <[email protected]>

--=20
NULL && (void)