From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
Rob Herring <rob.herring@calxeda.com>,
Lars-Peter Clausen <lars@metafoo.de>,
linux-kernel@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] driver-core: dev_to_node() should handle NULL pointers
Date: Fri, 20 Jul 2012 15:00:42 +0000 [thread overview]
Message-ID: <20120720150042.GA1996@kroah.com> (raw)
In-Reply-To: <20120720065622.GA11710@elgon.mountain>
On Fri, Jul 20, 2012 at 09:56:23AM +0300, Dan Carpenter wrote:
> What prompted this patch is that in dma_pool_create() we call
> dev_to_node() before checking whether "dev" is NULL. It looks like
> there are places which call dma_pool_create() with a NULL pointer. An
> example is in drivers/usb/gadget/amd5536udc.c.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static checker fix.
>
> diff --git a/include/linux/device.h b/include/linux/device.h
> index aa7b3b4..c80e7a8d 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -714,7 +714,9 @@ int dev_set_name(struct device *dev, const char *name, ...);
> #ifdef CONFIG_NUMA
> static inline int dev_to_node(struct device *dev)
> {
> - return dev->numa_node;
> + if (dev)
> + return dev->numa_node;
> + return -1;
What happens if this function returns -1? Can the callers properly
handle this?
thanks,
greg k-h
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
Rob Herring <rob.herring@calxeda.com>,
Lars-Peter Clausen <lars@metafoo.de>,
linux-kernel@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] driver-core: dev_to_node() should handle NULL pointers
Date: Fri, 20 Jul 2012 08:00:42 -0700 [thread overview]
Message-ID: <20120720150042.GA1996@kroah.com> (raw)
In-Reply-To: <20120720065622.GA11710@elgon.mountain>
On Fri, Jul 20, 2012 at 09:56:23AM +0300, Dan Carpenter wrote:
> What prompted this patch is that in dma_pool_create() we call
> dev_to_node() before checking whether "dev" is NULL. It looks like
> there are places which call dma_pool_create() with a NULL pointer. An
> example is in drivers/usb/gadget/amd5536udc.c.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static checker fix.
>
> diff --git a/include/linux/device.h b/include/linux/device.h
> index aa7b3b4..c80e7a8d 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -714,7 +714,9 @@ int dev_set_name(struct device *dev, const char *name, ...);
> #ifdef CONFIG_NUMA
> static inline int dev_to_node(struct device *dev)
> {
> - return dev->numa_node;
> + if (dev)
> + return dev->numa_node;
> + return -1;
What happens if this function returns -1? Can the callers properly
handle this?
thanks,
greg k-h
next prev parent reply other threads:[~2012-07-20 15:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-20 6:56 [patch] driver-core: dev_to_node() should handle NULL pointers Dan Carpenter
2012-07-20 6:56 ` Dan Carpenter
2012-07-20 15:00 ` Greg Kroah-Hartman [this message]
2012-07-20 15:00 ` Greg Kroah-Hartman
2012-07-20 15:18 ` Dan Carpenter
2012-07-20 15:18 ` Dan Carpenter
2012-08-16 17:23 ` Greg Kroah-Hartman
2012-08-16 17:23 ` Greg Kroah-Hartman
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=20120720150042.GA1996@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dan.carpenter@oracle.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=kernel-janitors@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.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.