linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Dave Switzer <david.switzer@intel.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 21/74] igb: handle vlan types with checker enabled
Date: Tue,  6 Jul 2021 07:24:09 -0400	[thread overview]
Message-ID: <20210706112502.2064236-21-sashal@kernel.org> (raw)
In-Reply-To: <20210706112502.2064236-1-sashal@kernel.org>

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

[ Upstream commit c7cbfb028b95360403d579c47aaaeef1ff140964 ]

The sparse build (C=2) finds some issues with how the driver
dealt with the (very difficult) hardware that in some generations
uses little-endian, and in others uses big endian, for the VLAN
field. The code as written picks __le16 as a type and for some
hardware revisions we override it to __be16 as done in this
patch. This impacted the VF driver as well so fix it there too.

Also change the vlan_tci assignment to override the sparse
warning without changing functionality.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Dave Switzer <david.switzer@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 5 +++--
 drivers/net/ethernet/intel/igbvf/netdev.c | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 7a4e2b014dd6..c37f0590b3a4 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2651,7 +2651,8 @@ static int igb_parse_cls_flower(struct igb_adapter *adapter,
 			}
 
 			input->filter.match_flags |= IGB_FILTER_FLAG_VLAN_TCI;
-			input->filter.vlan_tci = match.key->vlan_priority;
+			input->filter.vlan_tci =
+				(__force __be16)match.key->vlan_priority;
 		}
 	}
 
@@ -8255,7 +8256,7 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring,
 
 		if (igb_test_staterr(rx_desc, E1000_RXDEXT_STATERR_LB) &&
 		    test_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &rx_ring->flags))
-			vid = be16_to_cpu(rx_desc->wb.upper.vlan);
+			vid = be16_to_cpu((__force __be16)rx_desc->wb.upper.vlan);
 		else
 			vid = le16_to_cpu(rx_desc->wb.upper.vlan);
 
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index 0f2b68f4bb0f..77cb2ab7dab4 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -83,14 +83,14 @@ static int igbvf_desc_unused(struct igbvf_ring *ring)
 static void igbvf_receive_skb(struct igbvf_adapter *adapter,
 			      struct net_device *netdev,
 			      struct sk_buff *skb,
-			      u32 status, u16 vlan)
+			      u32 status, __le16 vlan)
 {
 	u16 vid;
 
 	if (status & E1000_RXD_STAT_VP) {
 		if ((adapter->flags & IGBVF_FLAG_RX_LB_VLAN_BSWAP) &&
 		    (status & E1000_RXDEXT_STATERR_LB))
-			vid = be16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK;
+			vid = be16_to_cpu((__force __be16)vlan) & E1000_RXD_SPC_VLAN_MASK;
 		else
 			vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK;
 		if (test_bit(vid, adapter->active_vlans))
-- 
2.30.2


  parent reply	other threads:[~2021-07-06 12:20 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 11:23 [PATCH AUTOSEL 5.4 01/74] drm/etnaviv: fix NULL check before some freeing functions is not needed Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 02/74] drm/mxsfb: Don't select DRM_KMS_FB_HELPER Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 03/74] drm/zte: " Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 04/74] drm/amd/amdgpu/sriov disable all ip hw status by default Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 05/74] drm/vc4: fix argument ordering in vc4_crtc_get_margins() Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 06/74] net: pch_gbe: Use proper accessors to BE data in pch_ptp_match() Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 07/74] drm/amd/display: fix use_max_lb flag for 420 pixel formats Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 08/74] hugetlb: clear huge pte during flush function on mips platform Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 09/74] atm: iphase: fix possible use-after-free in ia_module_exit() Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 10/74] mISDN: fix possible use-after-free in HFC_cleanup() Sasha Levin
2021-07-06 11:23 ` [PATCH AUTOSEL 5.4 11/74] atm: nicstar: Fix possible use-after-free in nicstar_cleanup() Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 12/74] net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 13/74] drm/mediatek: Fix PM reference leak in mtk_crtc_ddp_hw_init() Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 14/74] reiserfs: add check for invalid 1st journal block Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 15/74] drm/virtio: Fixes a potential NULL pointer dereference on probe failure Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 16/74] drm/virtio: Fix double free " Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 17/74] bpf: Check for BPF_F_ADJ_ROOM_FIXED_GSO when bpf_skb_change_proto Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 18/74] drm/sched: Avoid data corruptions Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 19/74] udf: Fix NULL pointer dereference in udf_symlink function Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 20/74] e100: handle eeprom as little endian Sasha Levin
2021-07-06 11:24 ` Sasha Levin [this message]
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 22/74] drm/bridge: cdns: Fix PM reference leak in cdns_dsi_transfer() Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 23/74] clk: renesas: r8a77995: Add ZA2 clock Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 24/74] clk: tegra: Ensure that PLLU configuration is applied properly Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 25/74] ipv6: use prandom_u32() for ID generation Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 26/74] RDMA/cxgb4: Fix missing error code in create_qp() Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 27/74] dm space maps: don't reset space map allocation cursor when committing Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 28/74] pinctrl: mcp23s08: fix race condition in irq handler Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 29/74] ice: set the value of global config lock timeout longer Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 30/74] virtio_net: Remove BUG() to avoid machine dead Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 31/74] net: bcmgenet: check return value after calling platform_get_resource() Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 32/74] net: mvpp2: " Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 33/74] net: micrel: " Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 34/74] net: moxa: Use devm_platform_get_and_ioremap_resource() Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 35/74] drm/amd/display: Update scaling settings on modeset Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 36/74] drm/amd/display: Release MST resources on switch from MST to SST Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 37/74] drm/amd/display: Set DISPCLK_MAX_ERRDET_CYCLES to 7 Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 38/74] drm/amdkfd: use allowed domain for vmbo validation Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 39/74] fjes: check return value after calling platform_get_resource() Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 40/74] selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 41/74] r8169: avoid link-up interrupt issue on RTL8106e if user enables ASPM Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 42/74] drm/amd/display: Verify Gamma & Degamma LUT sizes in amdgpu_dm_atomic_check Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 43/74] xfrm: Fix error reporting in xfrm_state_construct Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 44/74] wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 45/74] wl1251: Fix possible buffer overflow in wl1251_cmd_scan Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 46/74] cw1200: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 47/74] bpf: Fix up register-based shifts in interpreter to silence KUBSAN Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 48/74] mt76: mt7615: fix fixed-rate tx status reporting Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 49/74] net: fix mistake path for netdev_features_strings Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 50/74] net: sched: fix error return code in tcf_del_walker() Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 51/74] drm/amdkfd: Walk through list with dqm lock hold Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 52/74] rtl8xxxu: Fix device info for RTL8192EU devices Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 53/74] MIPS: add PMD table accounting into MIPS'pmd_alloc_one Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 54/74] atm: nicstar: use 'dma_free_coherent' instead of 'kfree' Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 55/74] atm: nicstar: register the interrupt handler in the right place Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 56/74] vsock: notify server to shutdown when client has pending signal Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 57/74] RDMA/rxe: Don't overwrite errno from ib_umem_get() Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 58/74] iwlwifi: mvm: don't change band on bound PHY contexts Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 59/74] iwlwifi: pcie: free IML DMA memory allocation Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 60/74] iwlwifi: pcie: fix context info freeing Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 61/74] sfc: avoid double pci_remove of VFs Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 62/74] sfc: error code if SRIOV cannot be disabled Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 63/74] wireless: wext-spy: Fix out-of-bounds warning Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 64/74] media, bpf: Do not copy more entries than user space requested Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 65/74] net: ip: avoid OOM kills with large UDP sends over loopback Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 66/74] RDMA/cma: Fix rdma_resolve_route() memory leak Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 67/74] Bluetooth: btusb: Fixed too many in-token issue for Mediatek Chip Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 68/74] Bluetooth: Fix the HCI to MGMT status conversion table Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 69/74] Bluetooth: Shutdown controller after workqueues are flushed or cancelled Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 70/74] Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc Sasha Levin
2021-07-06 11:24 ` [PATCH AUTOSEL 5.4 71/74] sctp: validate from_addr_param return Sasha Levin
2021-07-06 11:25 ` [PATCH AUTOSEL 5.4 72/74] sctp: add size validation when walking chunks Sasha Levin
2021-07-06 11:25 ` [PATCH AUTOSEL 5.4 73/74] MIPS: loongsoon64: Reserve memory below starting pfn to prevent Oops Sasha Levin
2021-07-06 11:25 ` [PATCH AUTOSEL 5.4 74/74] MIPS: set mips32r5 for virt extensions Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706112502.2064236-21-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=david.switzer@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).