sh_eth: check TSU registers ioremap() error
Subsystems (3)
PATCH 2/2 sh_eth: check TSU registers ioremap() error
One must check the result of ioremap() -- in this case it prevents potential kernel oops when initializing TSU registers further on...
--- drivers/net/ethernet/renesas/sh_eth.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/renesas/sh_eth.c +5 -0
@@ -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 ; }
David Miller
maintainerFrom: Sergei Shtylyov <[email protected]>
Date: Wed, 20 Mar 2013 02:41:32 +0300
Quoted 4 lines
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 <[email protected]>
Applied and queued up for -stable.
Hello.
Quoted 8 lines · David Miller
From: Sergei Shtylyov <[email protected]>
Date: Wed, 20 Mar 2013 02:41:32 +0300Quoted 4 lines
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 <[email protected]>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
Quoted 10 lines · Sergei Shtylyov
Quoted 7 lines
Quoted 6 lines
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 <[email protected]>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
It doesn't make sense to worry about branch misprediction during probe() :)
Quoted 24 lines · Sergei Shtylyov
Quoted 11 lines · Sergei Shtylyov
Quoted 8 lines
Quoted 7 lines
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 <[email protected]>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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello.
Quoted 1 line · Denis Kirjanov
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.
Quoted 7 lines · Sergei Shtylyov
Quoted 6 lines · Sergei Shtylyov
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
One must check the result of
ioremap()-- in this case it prevents potential
kernel oops when initializing TSU registers further on...
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Sergei Shtylyov <[email protected]>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