Xi Ruoyao 64b1a44183 libio: Add nonnull attribute for most FILE * arguments in stdio.h
During the review of a GCC analyzer test case, we found most stdio
functions accepting a FILE * argument expect it to be nonnull and just
segfault when the argument is NULL.  Add nonnull attribute for them.

fflush and fflush_unlocked are well defined when __stream is NULL so
they are not touched.

For fputs, fgets, fread, fwrite, fprintf, vfprintf, and their unlocked
version, if __stream is empty but there is nothing to read or write,
they did not segfault.  But the standard disallow __stream to be empty
here, so nonnull attribute is also added for them.  Note that this may
blow up some old code already subtly broken.

Also add __nonnull for _chk variants and __fortify_function versions for
them.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-09-26 20:11:38 -04:00
..
2023-06-13 19:59:08 -04:00
2023-06-01 12:40:05 -04:00
2023-06-01 12:40:05 -04:00
2023-06-01 12:40:05 -04:00
2023-06-01 12:40:05 -04:00
2023-06-01 12:40:05 -04:00
2023-07-05 16:59:48 +02:00
2023-07-20 23:42:56 +02:00
2023-09-08 23:00:04 +02:00