From e195442b701c35ac03871416ee7d0f9ee3991313 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ana=20Guerrero=20L=C3=B3pez?= Date: Tue, 1 Sep 2015 16:57:50 +0200 Subject: [PATCH] Do not use sizeof for array parameters. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Adrian Chiris --- small_utils/vpd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/small_utils/vpd.c b/small_utils/vpd.c index 44aae36..8cab06c 100644 --- a/small_utils/vpd.c +++ b/small_utils/vpd.c @@ -220,8 +220,8 @@ int pci_read_vpd_dword_gw(int fd, int vpd_cap_offset, unsigned offset, unsigned } } - ret = pread(fd, data, sizeof data, vpd_cap_offset + VPD_DATA_OFFSET); - if (ret != sizeof data) { + ret = pread(fd, data, 0x4, vpd_cap_offset + VPD_DATA_OFFSET); + if (ret != 0x4) { return ret; } -- 2.41.0