* [PATCH net-next] phylink: require valid state argument to phylink_validate_mask_caps()
@ 2022-10-25 18:51 Jakub Kicinski
2022-10-25 18:56 ` Sean Anderson
2022-10-27 3:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-10-25 18:51 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, Jakub Kicinski, linux, andrew,
hkallweit1, sean.anderson, rmk+kernel
state is deferenced earlier in the function, the NULL check
is pointless. Since we don't have any crash reports presumably
it's safe to assume state is not NULL.
Fixes: f392a1846489 ("net: phylink: provide phylink_validate_mask_caps() helper")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: linux@armlinux.org.uk
CC: andrew@lunn.ch
CC: hkallweit1@gmail.com
CC: sean.anderson@seco.com
CC: rmk+kernel@armlinux.org.uk
---
drivers/net/phy/phylink.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 62106c9e9a9d..88f60e98b760 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -564,7 +564,7 @@ EXPORT_SYMBOL_GPL(phylink_get_capabilities);
/**
* phylink_validate_mask_caps() - Restrict link modes based on caps
* @supported: ethtool bitmask for supported link modes.
- * @state: an (optional) pointer to a &struct phylink_link_state.
+ * @state: pointer to a &struct phylink_link_state.
* @mac_capabilities: bitmask of MAC capabilities
*
* Calculate the supported link modes based on @mac_capabilities, and restrict
@@ -585,8 +585,7 @@ void phylink_validate_mask_caps(unsigned long *supported,
phylink_caps_to_linkmodes(mask, caps);
linkmode_and(supported, supported, mask);
- if (state)
- linkmode_and(state->advertising, state->advertising, mask);
+ linkmode_and(state->advertising, state->advertising, mask);
}
EXPORT_SYMBOL_GPL(phylink_validate_mask_caps);
--
2.37.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] phylink: require valid state argument to phylink_validate_mask_caps()
2022-10-25 18:51 [PATCH net-next] phylink: require valid state argument to phylink_validate_mask_caps() Jakub Kicinski
@ 2022-10-25 18:56 ` Sean Anderson
2022-10-27 3:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Sean Anderson @ 2022-10-25 18:56 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, linux, andrew, hkallweit1, rmk+kernel
On 10/25/22 14:51, Jakub Kicinski wrote:
> state is deferenced earlier in the function, the NULL check
> is pointless. Since we don't have any crash reports presumably
> it's safe to assume state is not NULL.
Yes, I believe this was in place just for a patch which hasn't
been upstreamed.
> Fixes: f392a1846489 ("net: phylink: provide phylink_validate_mask_caps() helper")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: linux@armlinux.org.uk
> CC: andrew@lunn.ch
> CC: hkallweit1@gmail.com
> CC: sean.anderson@seco.com
> CC: rmk+kernel@armlinux.org.uk
> ---
> drivers/net/phy/phylink.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 62106c9e9a9d..88f60e98b760 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -564,7 +564,7 @@ EXPORT_SYMBOL_GPL(phylink_get_capabilities);
> /**
> * phylink_validate_mask_caps() - Restrict link modes based on caps
> * @supported: ethtool bitmask for supported link modes.
> - * @state: an (optional) pointer to a &struct phylink_link_state.
> + * @state: pointer to a &struct phylink_link_state.
> * @mac_capabilities: bitmask of MAC capabilities
> *
> * Calculate the supported link modes based on @mac_capabilities, and restrict
> @@ -585,8 +585,7 @@ void phylink_validate_mask_caps(unsigned long *supported,
> phylink_caps_to_linkmodes(mask, caps);
>
> linkmode_and(supported, supported, mask);
> - if (state)
> - linkmode_and(state->advertising, state->advertising, mask);
> + linkmode_and(state->advertising, state->advertising, mask);
> }
> EXPORT_SYMBOL_GPL(phylink_validate_mask_caps);
>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] phylink: require valid state argument to phylink_validate_mask_caps()
2022-10-25 18:51 [PATCH net-next] phylink: require valid state argument to phylink_validate_mask_caps() Jakub Kicinski
2022-10-25 18:56 ` Sean Anderson
@ 2022-10-27 3:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-10-27 3:20 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, linux, andrew, hkallweit1,
sean.anderson, rmk+kernel
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 25 Oct 2022 11:51:26 -0700 you wrote:
> state is deferenced earlier in the function, the NULL check
> is pointless. Since we don't have any crash reports presumably
> it's safe to assume state is not NULL.
>
> Fixes: f392a1846489 ("net: phylink: provide phylink_validate_mask_caps() helper")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>
> [...]
Here is the summary with links:
- [net-next] phylink: require valid state argument to phylink_validate_mask_caps()
https://git.kernel.org/netdev/net-next/c/e0b3ef17f45e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-27 3:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 18:51 [PATCH net-next] phylink: require valid state argument to phylink_validate_mask_caps() Jakub Kicinski
2022-10-25 18:56 ` Sean Anderson
2022-10-27 3:20 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.