From: Michael Ellerman <mpe@ellerman•id.au>
To: Suraj Jitindar Singh <sjitindarsingh@gmail•com>,
devicetree@vger•kernel.org, linuxppc-dev@lists•ozlabs.org
Cc: robh+dt@kernel•org, paulus@samba•org,
Suraj Jitindar Singh <sjitindarsingh@gmail•com>,
grant.likely@linaro•org, frowand.list@gmail•com
Subject: Re: [1/2] drivers/of: Add check for null property in of_remove_property()
Date: Thu, 5 May 2016 08:40:23 +1000 (AEST) [thread overview]
Message-ID: <3r0Y074wcfz9t4k@ozlabs.org> (raw)
In-Reply-To: <1461821695-19204-1-git-send-email-sjitindarsingh@gmail.com>
On Thu, 2016-28-04 at 05:34:54 UTC, Suraj Jitindar Singh wrote:
> The validity of the property input argument to of_remove_property() is
> never checked within the function and thus it is possible to pass a null
> value. It happens that this will be picked up in __of_remove_property()
> as no matching property of the device node will be found and thus an
> error will be returned, however once again there is no explicit check
> for a null value. By the time this is detected 2 locks have already been
> acquired which is completely unnecessary if the property to remove is
> null.
>
> Add an explicit check in the function of_remove_property() for a null
> property value and return -ENODEV in this case, this is consistent with
> what the previous return value would have been when the null value was
> not detected and passed to __of_remove_property().
>
> By moving an explicit check for the property paramenter into the
> of_remove_property() function, this will remove the need to perform this
> check in calling code before invocation of the of_remove_property()
> function.
>
> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail•com>
> Acked-by: Rob Herring <robh@kernel•org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/1c173cb23486f540ea08a5050a
cheers
prev parent reply other threads:[~2016-05-04 22:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-28 5:34 [PATCH 1/2] drivers/of: Add check for null property in of_remove_property() Suraj Jitindar Singh
2016-04-28 5:34 ` [PATCH 2/2] powerpc: Update of_remove_property() call sites to remove null checking Suraj Jitindar Singh
2016-05-03 22:32 ` Tyrel Datwyler
2016-05-05 6:50 ` Michael Ellerman
2016-05-06 1:01 ` Suraj Jitindar Singh
2016-05-06 3:00 ` Suraj Jitindar Singh
2016-05-09 9:41 ` Michael Ellerman
2016-05-04 22:40 ` [2/2] " Michael Ellerman
2016-05-03 13:06 ` [PATCH 1/2] drivers/of: Add check for null property in of_remove_property() Rob Herring
2016-05-04 22:40 ` Michael Ellerman [this message]
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=3r0Y074wcfz9t4k@ozlabs.org \
--to=mpe@ellerman$(echo .)id.au \
--cc=devicetree@vger$(echo .)kernel.org \
--cc=frowand.list@gmail$(echo .)com \
--cc=grant.likely@linaro$(echo .)org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=paulus@samba$(echo .)org \
--cc=robh+dt@kernel$(echo .)org \
--cc=sjitindarsingh@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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