From: Andrew Lunn <andrew@lunn•ch>
To: David Miller <davem@davemloft•net>
Cc: alvaro.gamez@hazent•com, dan.carpenter@oracle•com,
radhey.shyam.pandey@xilinx•com, michal.simek@xilinx•com,
linux@armlinux•org.uk, netdev@vger•kernel.org,
kernel-janitors@vger•kernel.org
Subject: Re: [PATCH net] net: axienet: fix a signedness bug in probe
Date: Wed, 25 Sep 2019 14:14:06 +0200 [thread overview]
Message-ID: <20190925121406.GA1864@lunn.ch> (raw)
In-Reply-To: <20190925.133507.2083224833639646147.davem@davemloft.net>
On Wed, Sep 25, 2019 at 01:35:07PM +0200, David Miller wrote:
> From: "Alvaro G. M" <alvaro.gamez@hazent•com>
> Date: Wed, 25 Sep 2019 13:05:43 +0200
>
> > Hi, Dan
> >
> > On Wed, Sep 25, 2019 at 01:59:11PM +0300, Dan Carpenter wrote:
> >> The "lp->phy_mode" is an enum but in this context GCC treats it as an
> >> unsigned int so the error handling is never triggered.
> >>
> >> lp->phy_mode = of_get_phy_mode(pdev->dev.of_node);
> >> - if (lp->phy_mode < 0) {
> >> + if ((int)lp->phy_mode < 0) {
> >
> > This (almost) exact code appears in a lot of different drivers too,
> > so maybe it'd be nice to review them all and apply the same cast if needed?
>
> Or make the thing an int if negative values are never valid 32-bit phy_mode
> values anyways.
Maybe we should change the API
int of_get_phy_mode(struct device_node *np, phy_interface_t *phy_mode);
Separate the error from the value we are getting.
Andrew
next prev parent reply other threads:[~2019-09-25 12:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 10:59 [PATCH net] net: axienet: fix a signedness bug in probe Dan Carpenter
2019-09-25 11:05 ` Alvaro G. M
2019-09-25 11:35 ` David Miller
2019-09-25 12:14 ` Andrew Lunn [this message]
2019-09-26 13:18 ` Dan Carpenter
2019-09-26 13:24 ` Andrew Lunn
2019-09-25 12:01 ` Radhey Shyam Pandey
2019-09-27 8:17 ` David Miller
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=20190925121406.GA1864@lunn.ch \
--to=andrew@lunn$(echo .)ch \
--cc=alvaro.gamez@hazent$(echo .)com \
--cc=dan.carpenter@oracle$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=kernel-janitors@vger$(echo .)kernel.org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=michal.simek@xilinx$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=radhey.shyam.pandey@xilinx$(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