[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20141214224123.GA4288@kroah.com>
Date: Sun, 14 Dec 2014 14:41:23 -0800
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: Benjamin Romer <benjamin.romer@...sys.com>,
David Kershner <david.kershner@...sys.com>,
Ken Cox <jkc@...hat.com>,
Erik Arfvidson <erik.arfvidson@...sys.com>,
Silvio F <silvio.fricke@...il.com>, sparmaintainer@...sys.com,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: unisys: virtpci: virtpci.c: Fix for possible
null pointer dereference
On Sun, Dec 14, 2014 at 11:41:11PM +0100, Rickard Strandqvist wrote:
> There is otherwise a risk of a possible null pointer dereference.
>
> Was largely found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
> ---
> drivers/staging/unisys/virtpci/virtpci.c | 23 +++++++++--------------
> 1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c
> index ee9f826..d818eda 100644
> --- a/drivers/staging/unisys/virtpci/virtpci.c
> +++ b/drivers/staging/unisys/virtpci/virtpci.c
> @@ -1314,15 +1314,13 @@ static ssize_t virtpci_driver_attr_show(struct kobject *kobj,
> ssize_t ret = 0;
>
> struct driver_private *dprivate = to_driver(kobj);
> - struct device_driver *driver;
>
> - if (dprivate != NULL)
> - driver = dprivate->driver;
> - else
> - driver = NULL;
> + if (dprivate) {
It is impossible for dprivate to ever be NULL, someone doesn't
understand how kobjects work :(
So just remove the check please, don't add more logic that will never
run.
thanks,
greg k-h
--
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