NET: ipv6, fix potential null dereference
Subsystems (2)
Quoted 1 line
Stanse found a potential null dereference
Nobody learns from Coverity, it seems. :^)
snmp6_unregister_dev() always called with valid idev.
Quoted 3 lines · Alexey Dobriyan
Quoted 1 line
Stanse found a potential null dereference
Nobody learns from Coverity, it seems. :^)
If it is known, why the test is still there?
I don't have access to the Coverity results anyway.
Quoted 1 line
snmp6_unregister_dev()always called with valid idev.
Ok, I'll post a patch to remove the check.
thanks,
Signature · 1 line
js
Quoted 8 lines · Jiri Slaby
Quoted 3 lines · Alexey Dobriyan
Quoted 1 line
Stanse found a potential null dereference
Nobody learns from Coverity, it seems. :^)
If it is known, why the test is still there?
I don't have access to the Coverity results anyway.
Well, when Coverity first exposed their database there were innumerable "potential NULL dereference" defects and people fixed them by moving stuff and most were bogus and there were flamewars and there were second wave and so on...
Apparently "check all callers" is very hard to do programmatically.
Quoted 1 line
Quoted 1 line
snmp6_unregister_dev()always called with valid idev.
irda patch is not right too: calling tty->ops->hook with NULL tty is impossible.
Quoted 6 lines · Alexey Dobriyan
Quoted 5 lines · Jiri Slaby
Quoted 3 lines · Alexey Dobriyan
Quoted 1 line
Stanse found a potential null dereference
Nobody learns from Coverity, it seems. :^)
Quoted 8 lines
Quoted 3 lines
If it is known, why the test is still there?
I don't have access to the Coverity results anyway.
Well, when Coverity first exposed their database there were innumerable "potential NULL dereference" defects and people fixed them by moving stuff and most were bogus and there were flamewars and there were second wave and so on...
Well, it is a clear error. Either the check is superfluous, or there is a potential NULL dereference.
And until people start to look at the reports for their stuff themselves, they will get bogus fixes from others. And they have to nack them, indeed.
While we are at it, could anybody look at (watch `task'):
int xprt_reserve_xprt(struct rpc_task *task)
{
struct rpc_rqst *req = task->tk_rqstp; <---- here
struct rpc_xprt *xprt = req->rq_xprt;
if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) {
if (task == xprt->snd_task)
return 1;
if (task == NULL) <------- here
return 0;And this (I checked 2.6.28, where netdev_priv was dev->priv):
static void __devexit de_remove_one (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct de_private *de = netdev_priv(dev);
BUG_ON(!dev);I know, currently netdev_priv returns dev+offset, but will this hold in the future?
Quoted 4 lines
Quoted 1 line
Quoted 1 line
snmp6_unregister_dev()always called with valid idev.irda patch is not right too: calling
tty->ops->hookwith NULL tty is impossible.
Yup, I somehow messed with tty->driver_data being NULL.
thanks,
Signature · 1 line
js
Quoted 3 lines · Jiri Slaby
And until people start to look at the reports for their stuff themselves, they will get bogus fixes from others. And they have to nack them, indeed.
Plus people sending such patches should plug in their brain. The tty case is clearly bogus.
PATCH 1/1 NET: ipv6, remove unnecessary check
In reply to Alexey DobriyanStanse found a potential null dereference in snmp6_unregister_dev. There is a check for idev being NULL, but it is dereferenced earlier. But idev cannot be NULL when passed to snmp6_unregister_dev, so remove the test.
--- net/ipv6/proc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv6/proc.c +1 -1
@@ -259,7 +259,7 @@ int snmp6_unregister_dev(struct inet6_dev *idev)struct net *net =dev_net (idev->dev);if (!net->mib.proc_net_devsnmp6)return -ENOENT ; -if (!idev || !idev->stats.proc_dir_entry) +if (!idev->stats.proc_dir_entry)return -EINVAL ;remove_proc_entry (idev->stats.proc_dir_entry->name, net->mib.proc_net_devsnmp6);
Signature · 1 line
1.6.5.7
Re: [PATCH 1/1] NET: ipv6, remove unnecessary check
From: Jiri Slaby <[email protected]>
Date: Sun, 10 Jan 2010 11:43:03 +0100
Quoted 6 lines
Stanse found a potential null dereference in
snmp6_unregister_dev. There is a check for idev being NULL, but it is dereferenced earlier. But idev cannot be NULL when passed tosnmp6_unregister_dev, so remove the test.Signed-off-by Jiri Slaby <[email protected]>
Applied.