* [PATCH net-next] net: ipv4: Fix the warning for dereference
@ 2021-08-30 9:16 Yajun Deng
2021-08-30 11:50 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Yajun Deng @ 2021-08-30 9:16 UTC (permalink / raw)
To: davem, yoshfuji, dsahern, kuba
Cc: netdev, linux-kernel, Yajun Deng, Dan Carpenter
Add a if statements to avoid the warning.
Dan Carpenter report:
The patch faf482ca196a: "net: ipv4: Move ip_options_fragment() out of
loop" from Aug 23, 2021, leads to the following Smatch complaint:
net/ipv4/ip_output.c:833 ip_do_fragment()
warn: variable dereferenced before check 'iter.frag' (see line 828)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: faf482ca196a ("net: ipv4: Move ip_options_fragment() out of loop")
Link: https://lore.kernel.org/netdev/20210830073802.GR7722@kadam/T/#t
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
net/ipv4/ip_output.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 9a8f05d5476e..9bca57ef8b83 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -825,7 +825,9 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
/* Everything is OK. Generate! */
ip_fraglist_init(skb, iph, hlen, &iter);
- ip_options_fragment(iter.frag);
+
+ if (iter.frag)
+ ip_options_fragment(iter.frag);
for (;;) {
/* Prepare header of the next frame,
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: ipv4: Fix the warning for dereference
2021-08-30 9:16 [PATCH net-next] net: ipv4: Fix the warning for dereference Yajun Deng
@ 2021-08-30 11:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-30 11:50 UTC (permalink / raw)
To: Yajun Deng
Cc: davem, yoshfuji, dsahern, kuba, netdev, linux-kernel, dan.carpenter
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Mon, 30 Aug 2021 17:16:40 +0800 you wrote:
> Add a if statements to avoid the warning.
>
> Dan Carpenter report:
> The patch faf482ca196a: "net: ipv4: Move ip_options_fragment() out of
> loop" from Aug 23, 2021, leads to the following Smatch complaint:
>
> net/ipv4/ip_output.c:833 ip_do_fragment()
> warn: variable dereferenced before check 'iter.frag' (see line 828)
>
> [...]
Here is the summary with links:
- [net-next] net: ipv4: Fix the warning for dereference
https://git.kernel.org/netdev/net-next/c/1b9fbe813016
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] 2+ messages in thread
end of thread, other threads:[~2021-08-30 11:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30 9:16 [PATCH net-next] net: ipv4: Fix the warning for dereference Yajun Deng
2021-08-30 11:50 ` patchwork-bot+netdevbpf
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).