Message ID | 201303200241.33137.sergei.shtylyov@cogentembedded.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Date: Wed, 20 Mar 2013 02:41:32 +0300 > One must check the result of ioremap() -- in this case it prevents potential > kernel oops when initializing TSU registers further on... > > Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Applied and queued up for -stable. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
It doesn't make sense to worry about branch misprediction during probe() :) On 3/20/13, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote: > On 03/20/2013 10:04 PM, Sergei Shtylyov wrote: > >> >>> >>>> One must check the result of ioremap() -- in this case it prevents >>>> potential >>>> kernel oops when initializing TSU registers further on... >>>> >>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> >>> Applied and queued up for -stable. >> >> Thanks. However, do you really think it's needed in stable? It's >> only error path, after all... > > I forgot to add "unlikely" to the "error path". I usually don't mark > such patches for stable, when I'm not in a hurry. :-) > > WBR, Sergei > > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello. On 03/20/2013 07:23 PM, David Miller wrote: > From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> > Date: Wed, 20 Mar 2013 02:41:32 +0300 > >> One must check the result of ioremap() -- in this case it prevents potential >> kernel oops when initializing TSU registers further on... >> >> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> > Applied and queued up for -stable. Thanks. However, do you really think it's needed in stable? It's only error path, after all... WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 03/20/2013 10:04 PM, Sergei Shtylyov wrote: > >> >>> One must check the result of ioremap() -- in this case it prevents >>> potential >>> kernel oops when initializing TSU registers further on... >>> >>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> >> Applied and queued up for -stable. > > Thanks. However, do you really think it's needed in stable? It's > only error path, after all... I forgot to add "unlikely" to the "error path". I usually don't mark such patches for stable, when I'm not in a hurry. :-) WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello. On 03/20/2013 09:20 PM, Denis Kirjanov wrote: > It doesn't make sense to worry about branch misprediction during probe() :) You misunderstood. I didn't mean using unlikely() at all, just that the ioremap() failure is unlikely. PS: Please, don't top post. > On 3/20/13, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote: >> On 03/20/2013 10:04 PM, Sergei Shtylyov wrote: >> >>>>> One must check the result of ioremap() -- in this case it prevents >>>>> potential >>>>> kernel oops when initializing TSU registers further on... >>>>> >>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> >>>> Applied and queued up for -stable. >>> Thanks. However, do you really think it's needed in stable? It's >>> only error path, after all... >> I forgot to add "unlikely" to the "error path". I usually don't mark >> such patches for stable, when I'm not in a hurry. :-) >> WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Index: renesas/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c +++ renesas/drivers/net/ethernet/renesas/sh_eth.c @@ -2446,6 +2446,11 @@ static int sh_eth_drv_probe(struct platf } mdp->tsu_addr = ioremap(rtsu->start, resource_size(rtsu)); + if (mdp->tsu_addr == NULL) { + ret = -ENOMEM; + dev_err(&pdev->dev, "TSU ioremap failed.\n"); + goto out_release; + } mdp->port = devno % 2; ndev->features = NETIF_F_HW_VLAN_FILTER; }
One must check the result of ioremap() -- in this case it prevents potential kernel oops when initializing TSU registers further on... Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> --- drivers/net/ethernet/renesas/sh_eth.c | 5 +++++ 1 file changed, 5 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html