From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Benjamin Romer <benjamin.romer@unisys.com>,
David Kershner <david.kershner@unisys.com>,
devel@driverdev.osuosl.org,
Erik Arfvidson <erik.arfvidson@unisys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
sparmaintainer@unisys.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: unisys: virtpci: virtpci: Fix for possible null pointer dereference
Date: Fri, 30 Jan 2015 15:39:42 +0300 [thread overview]
Message-ID: <20150130123942.GY6456@mwanda> (raw)
In-Reply-To: <1422557426-3929-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
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
next prev parent reply other threads:[~2015-01-30 12:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-29 18:50 [PATCH] staging: unisys: virtpci: virtpci: Fix for possible null pointer dereference Rickard Strandqvist
2015-01-30 12:39 ` Dan Carpenter [this message]
2015-01-30 12:59 ` Peter Hurley
2015-01-30 17:02 ` Rickard Strandqvist
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=20150130123942.GY6456@mwanda \
--to=dan.carpenter@oracle.com \
--cc=benjamin.romer@unisys.com \
--cc=david.kershner@unisys.com \
--cc=devel@driverdev.osuosl.org \
--cc=erik.arfvidson@unisys.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rickard_strandqvist@spectrumdigital.se \
--cc=sparmaintainer@unisys.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.