From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
"David S. Miller" <davem@davemloft.net>,
Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Vladimir Barinov <vladimir.barinov@cogentembedded.com>,
Chris Brandt <chris.brandt@renesas.com>,
netdev <netdev@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: renesas: fix a potential NULL pointer dereference
Date: Mon, 11 Mar 2019 08:43:35 +0100 [thread overview]
Message-ID: <CAMuHMdUcc2MXwX1sP4QEiWskoDofR8HQv-e2f9nWXhaMPeeZYA@mail.gmail.com> (raw)
In-Reply-To: <20190311070138.24084-1-kjlu@umn.edu>
Hi Kangjie,
On Mon, Mar 11, 2019 at 8:01 AM Kangjie Lu <kjlu@umn.edu> wrote:
> In case of_get_phy_mode fails, the fix returns NULL to avoid
> the NULL pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Thanks for your patch!
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -3187,6 +3187,8 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
> return NULL;
>
> pdata->phy_interface = of_get_phy_mode(np);
> + if (unlikely(!pdata->phy_interface))
> + return NULL;
of_get_phy_mode() does not return a pointer, but a phy mode index.
Hence zero is a valid value.
So I'm wondering where is the potential NULL pointer dereference?
Perhaps we do need to check for negative error codes?
Or is this already handled later, by {of_,}phy_connect()?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2019-03-11 7:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 7:01 Kangjie Lu
2019-03-11 7:43 ` Geert Uytterhoeven [this message]
2019-03-11 10:43 ` Sergei Shtylyov
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=CAMuHMdUcc2MXwX1sP4QEiWskoDofR8HQv-e2f9nWXhaMPeeZYA@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=chris.brandt@renesas.com \
--cc=davem@davemloft.net \
--cc=geert+renesas@glider.be \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pakki001@umn.edu \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=vladimir.barinov@cogentembedded.com \
--cc=vladimir_zapolskiy@mentor.com \
/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
all inboxes | Powered by JetHome®