]> git.openfabrics.org - ~adrianc/mstflint.git/commit
Do not use sizeof for array parameters.
authorAna Guerrero López <ana@ekaia.org>
Tue, 1 Sep 2015 14:57:50 +0000 (16:57 +0200)
committerAdrian Chiris <adrianc@mellanox.com>
Wed, 2 Sep 2015 06:47:02 +0000 (09:47 +0300)
commite195442b701c35ac03871416ee7d0f9ee3991313
treeee51646bcbe40dfe9c079ba68340ac738721caa9
parent4921962b412b5a465ae52b2820d73af03ef11e52
Do not use sizeof for array parameters.

It's not the most elegant of the fixes but properly fixing this requires
rewriting the function.

vpd.c: In function 'pci_read_vpd_dword_gw':
vpd.c:223:31: error: 'sizeof' on array function parameter 'data' will return size of 'unsigned char *' [-Werror=sizeof-array-argument]
  ret = pread(fd, data, sizeof data, vpd_cap_offset + VPD_DATA_OFFSET);
                               ^
vpd.c:189:86: note: declared here
 int pci_read_vpd_dword_gw(int fd, int vpd_cap_offset, unsigned offset, unsigned char data[4])
                                                                                      ^
vpd.c:224:20: error: 'sizeof' on array function parameter 'data' will return size of 'unsigned char *' [-Werror=sizeof-array-argument]
  if (ret != sizeof data) {
                    ^
vpd.c:189:86: note: declared here
 int pci_read_vpd_dword_gw(int fd, int vpd_cap_offset, unsigned offset, unsigned char data[4])

Signed-off-by: Ana Guerrero López <ana@ekaia.org>
Signed-off-by: Adrian Chiris <adrianc@mellanox.com>
small_utils/vpd.c