From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] perf: xgene: Remove bogus IS_ERR() check
Date: Fri, 14 Oct 2016 01:34:29 +0100 [thread overview]
Message-ID: <20161014003429.GD24167@remoulade> (raw)
In-Reply-To: <20161013181837.GQ19539@ZenIV.linux.org.uk>
On Thu, Oct 13, 2016 at 07:18:37PM +0100, Al Viro wrote:
> On Thu, Oct 13, 2016 at 11:09:16AM -0700, Tai Nguyen wrote:
> > In acpi_get_pmu_hw_inf we pass the address of a local variable to IS_ERR(),
> > which doesn't make sense, as the pointer must be a real, valid pointer.
> > This doesn't cause a functional problem, as IS_ERR() will evaluate as
> > false, but the check is bogus and causes static checkers to complain.
>
> ... unless the test is actually a misspelled IS_ERR(res) and the current
> code is broken by effectively skipping it.
Sure.
In this case, res is a struct resource, so IS_ERR(res) is also bogus.
None of the pointer fields in struct resource are ever set to an ERR_PTR value,
so nothing in res is worth checking. Nothing else in the function prior to this
would be an ERR_PTR value either.
I believe this case was copy-paste and a thinko. There's some other error
handling in the file that does validly have to handle an ERR_PTR value.
Thanks,
Mark.
prev parent reply other threads:[~2016-10-14 0:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 18:09 [PATCH v2] perf: xgene: Remove bogus IS_ERR() check Tai Nguyen
2016-10-13 18:18 ` Al Viro
2016-10-14 0:34 ` Mark Rutland [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=20161014003429.GD24167@remoulade \
--to=mark.rutland@arm.com \
--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).