Bug 861704 - acpi.c still has transposed memset() args
Summary: acpi.c still has transposed memset() args
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: acpi
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Johan Swensson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-30 07:03 UTC by Bruce Jerrick
Modified: 2013-10-29 20:53 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-10-29 20:53:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Bruce Jerrick 2012-09-30 07:03:06 UTC
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

How reproducible:
100%

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').

Actual results:
Compiler warnings re memset().

Expected results:
No such warning.

Additional info:
This is with gcc-4.7.0-5.fc17, but it's been happening since F15 (and
probably earlier).

(BTW, the GCC warning should use the term "argument" -- "parameter" means
a formal, not actual, argument.)

Comment 1 Johan Swensson 2013-10-29 20:53:27 UTC
This warning is no longer present in latest rawhide build.
https://koji.fedoraproject.org/koji/buildinfo?buildID=474679


Note You need to log in before you can comment on or make changes to this bug.