Bug #8398

pcmcia: sizeof on array function parameter

Added by Toomas Soome 6 months ago. Updated 6 months ago.

Status:ClosedStart date:2017-06-15
Priority:NormalDue date:
Assignee:Toomas Soome% Done:

100%

Category:driver - device drivers
Target version:-
Difficulty:Medium Tags:needs-triage

Description

Build error with gcc 6:

In file included from ../../common/pcmcia/nexus/pcmcia.c:64:0:
../../common/pcmcia/nexus/pcmcia.c: In function 'pcm_fix_bits':
../../common/sys/pcmcia.h:286:50: error: 'sizeof' on array function parameter 'dst' will return size of 'uchar_t * {aka unsigned char *}' [-Werror=sizeof-array-argument]
 #define PR_ZERO(map)  bzero((caddr_t)map, sizeof (map))
                                                  ^
../../common/pcmcia/nexus/pcmcia.c:1774:2: note: in expansion of macro 'PR_ZERO'
  PR_ZERO(dst);
  ^~~~~~~
../../common/pcmcia/nexus/pcmcia.c:1770:47: note: declared here
 pcm_fix_bits(socket_enum_t src, socket_enum_t dst, int num, int dir)
                                               ^~~
../../common/pcmcia/nexus/pcmcia.c:1778:28: error: 'sizeof' on array function parameter 'dst' will return size of 'uchar_t * {aka unsigned char *}' [-Werror=sizeof-array-argument]
   for (i = 0; i <= (sizeof (dst) * PR_WORDSIZE) - num; i++) {
                            ^
../../common/pcmcia/nexus/pcmcia.c:1770:47: note: declared here
 pcm_fix_bits(socket_enum_t src, socket_enum_t dst, int num, int dir)
                                               ^~~
../../common/pcmcia/nexus/pcmcia.c:1784:28: error: 'sizeof' on array function parameter 'dst' will return size of 'uchar_t * {aka unsigned char *}' [-Werror=sizeof-array-argument]
   for (i = num; i < sizeof (dst) * PR_WORDSIZE; i++) {
                            ^
../../common/pcmcia/nexus/pcmcia.c:1770:47: note: declared here
 pcm_fix_bits(socket_enum_t src, socket_enum_t dst, int num, int dir)
                                               ^~~
cc1: all warnings being treated as errors

History

#1 Updated by Electric Monk 6 months ago

  • % Done changed from 90 to 100
  • Status changed from In Progress to Closed

git commit 24a150c1bcca7eba0f2d518d0f41645eb55f6066

commit  24a150c1bcca7eba0f2d518d0f41645eb55f6066
Author: Toomas Soome <tsoome@me.com>
Date:   2017-06-19T14:34:11.000Z

    8398 pcmcia: sizeof on array function parameter
    Reviewed by: Marcel Telka <marcel@telka.sk>
    Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom