[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150130123942.GY6456@mwanda>
Date: Fri, 30 Jan 2015 15:39:42 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: Benjamin Romer <benjamin.romer@...sys.com>,
David Kershner <david.kershner@...sys.com>,
devel@...verdev.osuosl.org,
Erik Arfvidson <erik.arfvidson@...sys.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
sparmaintainer@...sys.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: unisys: virtpci: virtpci: Fix for possible null
pointer dereference
Run your patches through checkpatch.pl.
On Thu, Jan 29, 2015 at 07:50:26PM +0100, Rickard Strandqvist wrote:
> - if (dprivate != NULL)
> + if (dprivate != NULL) {
This is a double negative. Just say "if (dprivate) {". Actually just
reverse the test and remove the bogus printk. Say:
if (!dprivate)
return 0;
But *actually* just remove the test entirely because it can never be
NULL. Same for virtpci_driver_attr_store().
Btw, if you have the smatch cross function database set up then you can
figure out this sort of thing by using:
$ smdb.py virtpci_driver_attr_store
It says that:
fs/sysfs/file.c | sysfs_kf_write | (struct sysfs_ops)->store | PARAM_VALUE | 0 | $ | 4096-2117777777777777777
So this is called from sysfs_kf_write() and parameter zero is a valid
pointer.
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists