Re: [4/23] kallsyms: output binary data to speed output and kallsyms assembly
From: Markus Elfring
Date: Sat Sep 12 2026 - 02:41:21 EST
…
> > +++ b/scripts/kallsyms.c
…
> > +static void write_bin(FILE *file, const void *data, size_t len)
> > +{
> > + if (fwrite(data, 1, len, file) == len)
> > + return;
> > +
> > + perror("kallsyms: write");
> > + exit(EXIT_FAILURE);
> > +}
>
> It is pretty pointless checking the return value from fwrite().
> Most of the time it is just doing a memcpy().
> Instead call fflush() and the ferror() prior to the fclose().
> (Or just rely on fclose() giving you that error status.)
How does such a development view fit to other known programming advices?
https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-standard/rules/error-handling-err/err33-c/
https://cwe.mitre.org/data/definitions/252.html
Regards,
Markus