[4/23] kallsyms: output binary data to speed output and kallsyms assembly

Markus Elfring Markus.Elfring at web.de
Fri Sep 11 23:38:56 PDT 2026


…
> > +++ 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



More information about the linux-riscv mailing list