From: Dan Carpenter <dan.carpenter@oracle.com>
To: netdev@vger.kernel.org
Subject: inconsistent null checking in ipx_ioctl()
Date: Mon, 14 May 2012 23:56:18 +0300 [thread overview]
Message-ID: <20120514205618.GB20836@elgon.mountain> (raw)
Hi, I'm working on some new Smatch stuff and going through some warnings
in old code.
----
This is a semi-automatic email about new static checker warnings.
The patch b0d0d915d1d1: "ipx: remove the BKL" from Jan 25, 2011,
leads to the following Smatch complaint:
net/ipx/af_ipx.c:1928 ipx_ioctl()
error: we previously assumed 'sk' could be null (see line 1913)
net/ipx/af_ipx.c
1912 rc = -EINVAL;
1913 if (sk)
^^^^
Check.
1914 rc = sock_get_timestamp(sk, argp);
1915 break;
1916 case SIOCGIFDSTADDR:
1917 case SIOCSIFDSTADDR:
1918 case SIOCGIFBRDADDR:
1919 case SIOCSIFBRDADDR:
1920 case SIOCGIFNETMASK:
1921 case SIOCSIFNETMASK:
1922 rc = -EINVAL;
1923 break;
1924 default:
1925 rc = -ENOIOCTLCMD;
1926 break;
1927 }
1928 release_sock(sk);
^^^^^^^^^^^^^^^^^
The lock and release functions dereference "sk". Probably the check
can be removed. The rest of the function dereferences "sk" without
checking. A lot of this code goes back to 2.6.12.
1929
1930 return rc;
regards,
dan carpenter
next reply other threads:[~2012-05-14 20:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-14 20:56 Dan Carpenter [this message]
2012-05-19 4:51 ` inconsistent null checking in ipx_ioctl() David Miller
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=20120514205618.GB20836@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=netdev@vger.kernel.org \
/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