CID 1194318: We call the macro EFPRINTF without initialize the variable err.
CID 1194332: stdarg(3) says that each invocation of va_start() must be paired with a corresponding invocation of va_end() in the same function. In this case if an error occur with vfprintf() we forget to call va_end(ap).
Details
Details
Tested with FreeeBSD HEAD as a vm guest.
Tested with Fedora as a vm guest.
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
So I looked at acpi.c and I have a couple of thoughts:
- style(9) discourages assignments in declarations and the rest of acpi.c follows that by setting err to 0 on separate lines
- But bigger than that, the whole 'err' variable isn't necessary. EFPRINTF should just be:
if (fprintf(__VA_ARGS__) < 0) goto err_exit;
Likewise, EFFLUSH should check the return value of fflush() directly. The spurious 'err' variables should then be removed.
Comment Actions
Simplify both macros EFPRINTF and EFFLUSH and remove the unnecessary variable 'err'.
Likewise, remove varible 'err' from some functions that uses those two macros.
Thanks @jhb!