From: Michael Welling <mwelling@ieee.org>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: Handle postive return codes in phy_connect
Date: Sat, 5 Sep 2015 15:26:29 -0500 [thread overview]
Message-ID: <20150905202629.GB6250@deathstar> (raw)
In-Reply-To: <55EB4C87.4030309@gmail.com>
On Sat, Sep 05, 2015 at 01:11:51PM -0700, Florian Fainelli wrote:
> Le 09/05/15 12:47, Andrew Lunn a écrit :
> > On Sat, Sep 05, 2015 at 02:44:01PM -0500, Michael Welling wrote:
> >> On Sat, Sep 05, 2015 at 09:18:40PM +0200, Andrew Lunn wrote:
> >>> On Sat, Sep 05, 2015 at 01:01:29PM -0500, Michael Welling wrote:
> >>>> The function phy_connect_direct can possibly return a positive
> >>>> return code. Using ERR_PTR with a positive value can lead to
> >>>> deferencing of an invalid pointer.
> >>>
> >>> Is this the correct fix? Would it not be better to find where the
> >>> positive return code is from and fix that?
> >>
> >> I guess I can trace it back to find out where the positive return code
> >> is originating.
> >>
> >> Is phy_connect_direct always supposed to return valid -errno?
> >
> > I would look at this from a different angle. A positive ERRNO is
> > probably a bug of some sort. So rather than papering over the cracks,
> > go find what the real issue is.
>
> Agreed, you could place a WARN_ON(rc > 0) and get the offending call
> trace leading to that problem. I suspect that one of the PHY drivers
> might be returning a positive value as part of a phy_read() call and
> that does not get properly filtered out.
>
Thanks for the feedback.
Does it hurt to always have a warning on positive return codes before
using ERR_PTR?
> >
> > It might not be an ERRNO. E.g. https://lkml.org/lkml/2015/9/3/534
> > fixed a bug where a positive value is returned which is not an
> > indication of an error.
> >
> > Andrew
> >
> --
> Florian
next prev parent reply other threads:[~2015-09-05 20:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-05 18:01 [PATCH] net: phy: Handle postive return codes in phy_connect Michael Welling
2015-09-05 19:18 ` Andrew Lunn
2015-09-05 19:44 ` Michael Welling
2015-09-05 19:47 ` Andrew Lunn
2015-09-05 20:11 ` Florian Fainelli
2015-09-05 20:26 ` Michael Welling [this message]
2015-09-05 20:21 ` Michael Welling
2015-09-05 20:22 ` Andrew Lunn
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=20150905202629.GB6250@deathstar \
--to=mwelling@ieee.org \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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).