Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1098586ybz; Thu, 16 Apr 2020 02:52:22 -0700 (PDT) X-Google-Smtp-Source: APiQypKm7VgHyPRbtZH+IMMsf+ZJmw6+LSCnugtAYBdJWIIMeMURthimI3ryd+9EpP6lHlKoIFxt X-Received: by 2002:a05:6402:2c8:: with SMTP id b8mr28004146edx.242.1587030741978; Thu, 16 Apr 2020 02:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587030741; cv=none; d=google.com; s=arc-20160816; b=w6WVhVShwqz9/KqYQoNBlzW947abRaByVF1Eg5435MF2a2XxqGl9nwmMYjRTi9MJ4O 5FmS7LHYtraCwRD7J5NlPNTzJm2COFKqxQZ9VW1MGee+JC4vwKgxZRav5wiiCpeLhOLO B+3rxXY9MKosl0VOZRrxmxne+z0ao3q392znvG5MgnIsBek8DSJgPVxXP4rtbB2E1lVQ FtwZFEfk/YFhxFf6iKtNCDqtK/TBbIrRzZ8Uh7C2/dILnosHdA9zXZCk8KT/Pc1tgD5k zsbeh5nCefEWzRdWUtfPrNVOHA3QE0IVcyFclNFzjbm6+sGyLbwdFzl1TFZpuAyyMXOl ZrCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XdRGtlUvtbG5wpSul9OACdOKTMKTvTUSVonf9Og6t6I=; b=ALn/CtmgyS+WT6QO7NnnJ4i9R/NS7lIonWh4l/34l9+6p2lTUvGFEAq6sRBOgr7myj 5tbbZmisL1Vl4Dv86S5Vgj1RqaZsVtVwHanQYfKK1TX8fUMWe2kDMMrYXrNcEtR61ekt JPjQUUWAwIFBRn7iQd1fB5qWntuitPlobTwQEhW+s4uIzBF47HhhmfANASRQu2iCtX9d 6vWgoAFfr6fHe4+StrZ9oYQILWI8cHTYJFO2t+21jDitn8Y8TNyM+xqX4I1id1qWXUlx x5y7F1S4CSyIaz8Og++03yeIK3io+5HIc7T/KIfYt8CP3RcnfVPK+KjoySdZkj1DS+XV nHCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si11948037ejg.296.2020.04.16.02.51.59; Thu, 16 Apr 2020 02:52:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504160AbgDPJvF (ORCPT + 99 others); Thu, 16 Apr 2020 05:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2504038AbgDPJuy (ORCPT ); Thu, 16 Apr 2020 05:50:54 -0400 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01985C061A0C for ; Thu, 16 Apr 2020 02:50:53 -0700 (PDT) Received: from ramsan ([IPv6:2a02:1810:ac12:ed60:fd83:81bb:c1d7:433d]) by michel.telenet-ops.be with bizsmtp id TMqr220064dKHqf06Mqrzy; Thu, 16 Apr 2020 11:50:51 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1jP1AZ-00013K-2g; Thu, 16 Apr 2020 11:50:51 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1jP1AZ-0003N5-0d; Thu, 16 Apr 2020 11:50:51 +0200 From: Geert Uytterhoeven To: Jeff Kirsher , "David S . Miller" Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] virtchnl: Add missing explicit padding to structures Date: Thu, 16 Apr 2020 11:50:49 +0200 Message-Id: <20200416095049.12917-1-geert@linux-m68k.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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@ellerman.id.au Signed-off-by: Geert Uytterhoeven --- 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(+) diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h index ca956b672ac0f759..40bad71865ea7628 100644 --- a/include/linux/avf/virtchnl.h +++ b/include/linux/avf/virtchnl.h @@ -476,6 +476,7 @@ struct virtchnl_rss_key { u16 vsi_id; u16 key_len; u8 key[1]; /* RSS hash key, packed bytes */ + u8 pad[1]; }; VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_key); @@ -484,6 +485,7 @@ struct virtchnl_rss_lut { u16 vsi_id; u16 lut_entries; u8 lut[1]; /* RSS lookup table */ + u8 pad[1]; }; VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut); @@ -572,6 +574,7 @@ struct virtchnl_filter { enum virtchnl_action action; u32 action_meta; u8 field_flags; + u8 pad[3]; }; VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter); @@ -610,6 +613,7 @@ struct virtchnl_pf_event { /* link_speed provided in Mbps */ u32 link_speed; u8 link_status; + u8 pad[3]; } link_event_adv; } event_data; @@ -635,6 +639,7 @@ struct virtchnl_iwarp_qv_info { u16 ceq_idx; u16 aeq_idx; u8 itr_idx; + u8 pad[3]; }; VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info); -- 2.17.1