netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] net: ipv4: Move ip_options_fragment() out of loop
@ 2021-08-27  8:49 Dan Carpenter
  2021-08-27  9:23 ` yajun.deng
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-08-27  8:49 UTC (permalink / raw)
  To: yajun.deng; +Cc: netdev

Hello Yajun Deng,

This is a semi-automatic email about new static checker warnings.

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)

net/ipv4/ip_output.c
   827			ip_fraglist_init(skb, iph, hlen, &iter);
                                                         ^^^^^
iter.frag is set here.

   828			ip_options_fragment(iter.frag);
                                            ^^^^^^^^^
The patch introduces a new dereference here

   829	
   830			for (;;) {
   831				/* Prepare header of the next frame,
   832				 * before previous one went down. */
   833				if (iter.frag) {
                                    ^^^^^^^^^
But the old code assumed that "iter.frag" could be NULL.

   834					IPCB(iter.frag)->flags = IPCB(skb)->flags;
   835					ip_fraglist_prepare(skb, &iter);

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-30  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-27  8:49 [bug report] net: ipv4: Move ip_options_fragment() out of loop Dan Carpenter
2021-08-27  9:23 ` yajun.deng
2021-08-30  7:38   ` Dan Carpenter

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).