[PATCH v2] tools: hv: suppress the invalid warning for packed member alignment

Saurabh Sengar posted 1 patch 1 year, 7 months ago
There is a newer version of this series
tools/hv/Makefile | 1 +
1 file changed, 1 insertion(+)
[PATCH v2] tools: hv: suppress the invalid warning for packed member alignment
Posted by Saurabh Sengar 1 year, 7 months ago
Packed struct vmbus_bufring is 4096 byte aligned and the reporting
warning is for the first member of that struct which shouldn't add
any offset to create alignment issue.

Suppress the warning by adding -Wno-address-of-packed-member flag to
gcc.

Fixes: 45bab4d74651 ("tools: hv: Add vmbus_bufring")
Reported-by: kernel test robot <yujie.liu@intel.com>
Closes: https://lore.kernel.org/all/202404121913.GhtSoKbW-lkp@intel.com/
Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
---
[V2] Added 'Fixes' tag

 tools/hv/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/hv/Makefile b/tools/hv/Makefile
index bb52871..2e60e2c 100644
--- a/tools/hv/Makefile
+++ b/tools/hv/Makefile
@@ -17,6 +17,7 @@ endif
 MAKEFLAGS += -r
 
 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
+override CFLAGS += -Wno-address-of-packed-member
 
 ALL_TARGETS := hv_kvp_daemon hv_vss_daemon
 ifneq ($(ARCH), aarch64)
-- 
1.8.3.1
Re: [PATCH v2] tools: hv: suppress the invalid warning for packed member alignment
Posted by Wei Liu 1 year, 6 months ago
On Sun, May 05, 2024 at 10:38:58PM -0700, Saurabh Sengar wrote:
> Packed struct vmbus_bufring is 4096 byte aligned and the reporting
> warning is for the first member of that struct which shouldn't add
> any offset to create alignment issue.
> 
> Suppress the warning by adding -Wno-address-of-packed-member flag to
> gcc.
> 
> Fixes: 45bab4d74651 ("tools: hv: Add vmbus_bufring")
> Reported-by: kernel test robot <yujie.liu@intel.com>
> Closes: https://lore.kernel.org/all/202404121913.GhtSoKbW-lkp@intel.com/
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>

Applied to hyperv-fixes, thanks.