From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kbuild@01.org, kbuild-all@01.org,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [PATCH 4/6] drivers: base: Introducing software nodes to the firmware node framework
Date: Wed, 7 Nov 2018 14:33:35 +0200 [thread overview]
Message-ID: <20181107123335.GF13048@kuha.fi.intel.com> (raw)
In-Reply-To: <20181107043933.wqszrfajrfy6hv7u@mwanda>
On Wed, Nov 07, 2018 at 07:39:33AM +0300, Dan Carpenter wrote:
> Hi Heikki,
>
> url: https://github.com/0day-ci/linux/commits/Heikki-Krogerus/device-property-Introducing-software-nodes/20181106-031310
>
> smatch warnings:
> drivers/base/swnode.c:391 fwnode_create_software_node() error: dereferencing freed memory 'swnode'
>
> # https://github.com/0day-ci/linux/commit/a8c9678ea46a0171baed68e4ec355a9b3f967458
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout a8c9678ea46a0171baed68e4ec355a9b3f967458
> vim +/swnode +391 drivers/base/swnode.c
>
> a8c9678e Heikki Krogerus 2018-11-05 365
> a8c9678e Heikki Krogerus 2018-11-05 366 struct fwnode_handle *
> a8c9678e Heikki Krogerus 2018-11-05 367 fwnode_create_software_node(const struct property_entry *properties,
> a8c9678e Heikki Krogerus 2018-11-05 368 const struct fwnode_handle *parent)
> a8c9678e Heikki Krogerus 2018-11-05 369 {
> a8c9678e Heikki Krogerus 2018-11-05 370 struct software_node *p = NULL;
> a8c9678e Heikki Krogerus 2018-11-05 371 struct software_node *swnode;
> a8c9678e Heikki Krogerus 2018-11-05 372 char node_name[20];
> a8c9678e Heikki Krogerus 2018-11-05 373 int ret;
> a8c9678e Heikki Krogerus 2018-11-05 374
> a8c9678e Heikki Krogerus 2018-11-05 375 if (parent) {
> a8c9678e Heikki Krogerus 2018-11-05 376 if (IS_ERR(parent))
> a8c9678e Heikki Krogerus 2018-11-05 377 return ERR_CAST(parent);
> a8c9678e Heikki Krogerus 2018-11-05 378 if (!is_software_node(parent))
> a8c9678e Heikki Krogerus 2018-11-05 379 return ERR_PTR(-EINVAL);
> a8c9678e Heikki Krogerus 2018-11-05 380 p = to_software_node(parent);
> a8c9678e Heikki Krogerus 2018-11-05 381 }
> a8c9678e Heikki Krogerus 2018-11-05 382
> a8c9678e Heikki Krogerus 2018-11-05 383 swnode = kzalloc(sizeof(*swnode), GFP_KERNEL);
> a8c9678e Heikki Krogerus 2018-11-05 384 if (!swnode)
> a8c9678e Heikki Krogerus 2018-11-05 385 return ERR_PTR(-ENOMEM);
> a8c9678e Heikki Krogerus 2018-11-05 386
> a8c9678e Heikki Krogerus 2018-11-05 387 swnode->id = ida_simple_get(p ? &p->child_ids : &swnode_root_ids, 0, 0,
> a8c9678e Heikki Krogerus 2018-11-05 388 GFP_KERNEL);
> a8c9678e Heikki Krogerus 2018-11-05 389 if (swnode->id < 0) {
> a8c9678e Heikki Krogerus 2018-11-05 390 kfree(swnode);
> ^^^^^^
> a8c9678e Heikki Krogerus 2018-11-05 @391 return ERR_PTR(swnode->id);
> ^^^^^^^^^^
> a8c9678e Heikki Krogerus 2018-11-05 392 }
Thanks!
--
heikki
next prev parent reply other threads:[~2018-11-07 12:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-05 14:59 [PATCH 0/6] device property: Introducing software nodes Heikki Krogerus
2018-11-05 14:59 ` [PATCH 1/6] driver core: platform: Remove duplicated device_remove_properties() call Heikki Krogerus
2018-11-05 14:59 ` [PATCH 2/6] drivers core: Prepare support for multiple platform notifications Heikki Krogerus
2018-11-05 14:59 ` [PATCH 3/6] ACPI / glue: Add acpi_platform_notify() function Heikki Krogerus
2018-11-05 14:59 ` [PATCH 4/6] drivers: base: Introducing software nodes to the firmware node framework Heikki Krogerus
2018-11-07 4:39 ` Dan Carpenter
2018-11-07 12:33 ` Heikki Krogerus [this message]
2018-11-05 14:59 ` [PATCH 5/6] device property: Move device_add_properties() to swnode.c Heikki Krogerus
2018-11-05 14:59 ` [PATCH 6/6] device property: Remove struct property_set Heikki Krogerus
2018-11-06 14:46 ` Andy Shevchenko
2018-11-07 12:34 ` Heikki Krogerus
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=20181107123335.GF13048@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.carpenter@oracle.com \
--cc=dmitry.torokhov@gmail.com \
--cc=kbuild-all@01.org \
--cc=kbuild@01.org \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rjw@rjwysocki.net \
/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