RE: [Intel-wired-lan] [PATCH] virtchnl: Add missing explicit padding to structures
From: Bowers, AndrewX
Date: Wed Apr 22 2020 - 14:51:21 EST
-----Original Message-----
From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf Of Geert Uytterhoeven
Sent: Thursday, April 16, 2020 2:51 AM
To: Kirsher, Jeffrey T <jeffrey.t.kirsher@xxxxxxxxx>; David S . Miller <davem@xxxxxxxxxxxxx>
Cc: netdev@xxxxxxxxxxxxxxx; intel-wired-lan@xxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Subject: [Intel-wired-lan] [PATCH] virtchnl: Add missing explicit padding to structures
On e.g. m68k, the alignment of 32-bit values is only 2 bytes, leading
to:
./include/linux/avf/virtchnl.h:147:36: warning: division by zero [-Wdiv-by-zero]
{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
^
./include/linux/avf/virtchnl.h:577:1: note: in expansion of macro âVIRTCHNL_CHECK_STRUCT_LENâ
VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
^~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/avf/virtchnl.h:577:32: error: enumerator value for âvirtchnl_static_assert_virtchnl_filterâ is not an integer constant
VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
^~~~~~~~~~~~~~~
./include/linux/avf/virtchnl.h:147:53: note: in definition of macro âVIRTCHNL_CHECK_STRUCT_LENâ
{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
^
./include/linux/avf/virtchnl.h:147:36: warning: division by zero [-Wdiv-by-zero]
{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
^
./include/linux/avf/virtchnl.h:619:1: note: in expansion of macro âVIRTCHNL_CHECK_STRUCT_LENâ
VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);
^~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/avf/virtchnl.h:619:31: error: enumerator value for âvirtchnl_static_assert_virtchnl_pf_eventâ is not an integer constant
VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);
^~~~~~~~~~~~~~~~~
./include/linux/avf/virtchnl.h:147:53: note: in definition of macro âVIRTCHNL_CHECK_STRUCT_LENâ
{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
^
./include/linux/avf/virtchnl.h:147:36: warning: division by zero [-Wdiv-by-zero]
{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
^
./include/linux/avf/virtchnl.h:640:1: note: in expansion of macro âVIRTCHNL_CHECK_STRUCT_LENâ
VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);
^~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/avf/virtchnl.h:640:31: error: enumerator value for âvirtchnl_static_assert_virtchnl_iwarp_qv_infoâ is not an integer constant
VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);
^~~~~~~~~~~~~~~~~~~~~~
./include/linux/avf/virtchnl.h:147:53: note: in definition of macro âVIRTCHNL_CHECK_STRUCT_LENâ
{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
^
./include/linux/avf/virtchnl.h:147:36: warning: division by zero [-Wdiv-by-zero]
{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
^
./include/linux/avf/virtchnl.h:647:1: note: in expansion of macro âVIRTCHNL_CHECK_STRUCT_LENâ
VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);
^~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/avf/virtchnl.h:647:31: error: enumerator value for âvirtchnl_static_assert_virtchnl_iwarp_qvlist_infoâ is not an integer constant
VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);
^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/avf/virtchnl.h:147:53: note: in definition of macro âVIRTCHNL_CHECK_STRUCT_LENâ
{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
^
Fix this by adding explicit padding to structures with holes.
Reported-by: noreply@xxxxxxxxxxxxxx
Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
Exposed by the "select PCI" in commit 4be5e8648b0c287a ("media: move CEC platform drivers to a separate directory").
---
include/linux/avf/virtchnl.h | 5 +++++
1 file changed, 5 insertions(+)
Tested-by: Andrew Bowers <andrewx.bowers@xxxxxxxxx>