Red Hat Bugzilla – Bug 861704
acpi.c still has transposed memset() args
Last modified: 2013-10-29 16:53:27 EDT
Description of problem:
The second and third args of the menset() call in acpi.c are transposed.
GCC knows this and fixes them (or at least it used to), but it would be
better to clean it up.
Version-Release number of selected component:
acpi-1.5-4.fc18.src.rpm # and earlier
Steps to Reproduce:
Either 'rpmbuild -bc' the acpi package from SRPM and look for the warnings:
"warning: memset used with constant zero length parameter; this could be
due to transposed parameters"
Or just examine the code and compare it to the man page:
$ grep memset acpi.c
memset(trip, sizeof trip, 0);
$ man memset | fgrep 'void *memset'
void *memset(void *s, int c, size_t n);
Mr. Posix says the same thing ('man -s3p memset').
Compiler warnings re memset().
No such warning.
This is with gcc-4.7.0-5.fc17, but it's been happening since F15 (and
(BTW, the GCC warning should use the term "argument" -- "parameter" means
a formal, not actual, argument.)
This warning is no longer present in latest rawhide build.