Re: [PATCH 5.10 130/135] net: qede: Fix end of loop tests for list_for_each_entry
From: Pavel Machek
Date: Wed Aug 11 2021 - 03:11:21 EST
Hi!
> [ Upstream commit 795e3d2ea68e489ee7039ac29e98bfea0e34a96c ]
>
> The list_for_each_entry() iterator, "vlan" in this code, can never be
> NULL so the warning will never be printed.
Could someone double-check this? Because changelog is not accurate;
condition is using logical or, so warning can be printed. I don't
really see a bug with the old code.
New code is quite confusing, and if the vlan with required vic is the
"head" one, it will do the wrong thing, no?
Best regards,
Pavel
> +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
> @@ -842,7 +842,7 @@ int qede_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
> if (vlan->vid == vid)
> break;
>
> - if (!vlan || (vlan->vid != vid)) {
> + if (list_entry_is_head(vlan, &edev->vlan_list, list)) {
> DP_VERBOSE(edev, (NETIF_MSG_IFUP | NETIF_MSG_IFDOWN),
> "Vlan isn't configured\n");
> goto out;
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Attachment:
signature.asc
Description: PGP signature