From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/8] component: add support for component match array
Date: Fri, 4 Jul 2014 11:52:58 +0100 [thread overview]
Message-ID: <20140704105258.GF21766@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAK5sBcEupbnzpxskD8D7wXbFRfU+4gh5oDE9X-SvkZEQ2+dQ_w@mail.gmail.com>
On Fri, Jul 04, 2014 at 04:17:35PM +0530, Sachin Kamat wrote:
> Hi Russell
>
> > +int component_master_add_with_match(struct device *dev,
> > + const struct component_master_ops *ops,
> > + struct component_match *match)
> > {
> > struct master *master;
> > int ret;
> >
> > + if (ops->add_components && match)
> > + return -EINVAL;
> > +
> > + /* Reallocate the match array for its true size */
> > + match = component_match_realloc(dev, match, match->num);
>
> ^^^^^^^^^^^^^
> This gives a NULL pointer dereference error when match is NULL (as passed
> by component_master_add() below). Observed this while testing linux-next
> kernel (next-20140704) on Exynos based board with DRM enabled.
Thanks for your report. Please verify that the patch below resolves it
for you. Thanks.
drivers/base/component.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/base/component.c b/drivers/base/component.c
index b4236daed4fa..f748430bb654 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -293,10 +293,12 @@ int component_master_add_with_match(struct device *dev,
if (ops->add_components && match)
return -EINVAL;
- /* Reallocate the match array for its true size */
- match = component_match_realloc(dev, match, match->num);
- if (IS_ERR(match))
- return PTR_ERR(match);
+ if (match) {
+ /* Reallocate the match array for its true size */
+ match = component_match_realloc(dev, match, match->num);
+ if (IS_ERR(match))
+ return PTR_ERR(match);
+ }
master = kzalloc(sizeof(*master), GFP_KERNEL);
if (!master)
--
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
next parent reply other threads:[~2014-07-04 10:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAK5sBcEupbnzpxskD8D7wXbFRfU+4gh5oDE9X-SvkZEQ2+dQ_w@mail.gmail.com>
2014-07-04 10:52 ` Russell King - ARM Linux [this message]
2014-07-04 11:30 ` [PATCH v3 3/8] component: add support for component match array Sachin Kamat
2014-07-04 12:25 ` Russell King - ARM Linux
2014-07-04 13:44 ` Sachin Kamat
2014-07-01 14:40 [PATCH v3 0/8] component helper improvements Russell King - ARM Linux
2014-07-01 14:46 ` [PATCH v3 3/8] component: add support for component match array Russell King
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=20140704105258.GF21766@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).