Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1219640

Re: [PATCH] net: phy: Handle postive return codes in phy_connect

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Michael Welling <mwelling@ieee.org>
Newsgroups linux.kernel
Subject Re: [PATCH] net: phy: Handle postive return codes in phy_connect
Date Sat, 05 Sep 2015 22:30:02 +0200
Message-ID <q5sg2-2BP-7@gated-at.bofh.it> (permalink)
References <q5q4x-81k-7@gated-at.bofh.it> <q5rjY-1gU-15@gated-at.bofh.it> <q5rDj-1Dm-1@gated-at.bofh.it> <q5rN0-1OZ-5@gated-at.bofh.it> <q5s6m-2qs-13@gated-at.bofh.it>
X-Original-To Florian Fainelli <f.fainelli@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=sNYKDOSt9Ul0/J3pE0HYcqZX5m6sLspNC7K990ccjWo=; b=FU9rqNOdQh8IzH+c4bXSNKXtv/FdrVEIERNQ6D5KI1oK2rpCiCYHaF/OzUae8fzISX gPOaBtcBtG3K0TbTzfe+hABRn0VviqHIEFwZms9GCRAnry+3yILkEQCMDM+alWeh7I0G LUIivkLA4WAVnxXmbtXF+ajB8/mNf4QHsu1LXX2fYLSP00NmkagmgvKKuwm3/Aoh7BRG 0biP1VQ3TaBh1obRgocVd2h+4WaX3HUNOxIMPAlCTtKumiBC6srCVYKKVqyzQiGE72I7 h5EJnXRcOeZ7asE6lUov+GC9YhupLdBrknU9TsVQcR/z7vyS3cgDRvQZGWrznGLH5VK6 wLLg==
X-Received by 10.107.38.67 with SMTP id m64mr17850741iom.89.1441484795581; Sat, 05 Sep 2015 13:26:35 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Disposition inline
Content-Transfer-Encoding 8bit
User-Agent Mutt/1.5.23 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 46
Organization linux.* mail to news gateway
X-Original-Cc Andrew Lunn <andrew@lunn.ch>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Sat, 5 Sep 2015 15:26:29 -0500
X-Original-Message-ID <20150905202629.GB6250@deathstar>
X-Original-References <1441476089-22108-1-git-send-email-mwelling@ieee.org> <20150905191840.GC6040@lunn.ch> <20150905194400.GA1687@deathstar> <20150905194755.GD6040@lunn.ch> <55EB4C87.4030309@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1219640

Show key headers only | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] net: phy: Handle postive return codes in phy_connect Michael Welling <mwelling@ieee.org> - 2015-09-05 20:10 +0200
  Re: [PATCH] net: phy: Handle postive return codes in phy_connect Andrew Lunn <andrew@lunn.ch> - 2015-09-05 21:30 +0200
    Re: [PATCH] net: phy: Handle postive return codes in phy_connect Michael Welling <mwelling@ieee.org> - 2015-09-05 21:50 +0200
      Re: [PATCH] net: phy: Handle postive return codes in phy_connect Andrew Lunn <andrew@lunn.ch> - 2015-09-05 22:00 +0200
        Re: [PATCH] net: phy: Handle postive return codes in phy_connect Florian Fainelli <f.fainelli@gmail.com> - 2015-09-05 22:20 +0200
          Re: [PATCH] net: phy: Handle postive return codes in phy_connect Michael Welling <mwelling@ieee.org> - 2015-09-05 22:30 +0200
        Re: [PATCH] net: phy: Handle postive return codes in phy_connect Michael Welling <mwelling@ieee.org> - 2015-09-05 22:30 +0200
          Re: [PATCH] net: phy: Handle postive return codes in phy_connect Andrew Lunn <andrew@lunn.ch> - 2015-09-05 22:40 +0200

csiph-web