From: Dan Carpenter <dan.carpenter@oracle.com>
To: yajun.deng@linux.dev
Cc: netdev@vger.kernel.org
Subject: [bug report] net: ipv4: Move ip_options_fragment() out of loop
Date: Fri, 27 Aug 2021 11:49:15 +0300 [thread overview]
Message-ID: <20210827084915.GA8737@kili> (raw)
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
next reply other threads:[~2021-08-27 8:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 8:49 Dan Carpenter [this message]
2021-08-27 9:23 ` [bug report] net: ipv4: Move ip_options_fragment() out of loop yajun.deng
2021-08-30 7:38 ` Dan Carpenter
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=20210827084915.GA8737@kili \
--to=dan.carpenter@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=yajun.deng@linux.dev \
/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).