* [PATCH] Net: ethernet: mediatek - Fix possible NULL derefrence.
[not found] <CGME20170127111947epcas2p14f5ea86f0069142be02339754fda4a55@epcas2p1.samsung.com>
@ 2017-01-27 11:19 ` Shailendra Verma
0 siblings, 0 replies; 8+ messages in thread
From: Shailendra Verma @ 2017-01-27 11:19 UTC (permalink / raw)
To: Felix Fietkau, John Crispin, Matthias Brugger, netdev,
linux-arm-kernel, linux-mediatek, linux-kernel, p.shailesh,
ashish.kalra, Shailendra Verma, Shailendra Verma
of_match_device could return NULL, and so can cause a NULL
pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 4a62ffd..4495b7b 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)
int i;
match = of_match_device(of_mtk_match, &pdev->dev);
+ if (!match) {
+ dev_err(&pdev->dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
soc = (struct mtk_soc_data *)match->data;
eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] Net: ethernet: mediatek - Fix possible NULL derefrence.
@ 2017-01-27 11:19 ` Shailendra Verma
0 siblings, 0 replies; 8+ messages in thread
From: Shailendra Verma @ 2017-01-27 11:19 UTC (permalink / raw)
To: linux-arm-kernel
of_match_device could return NULL, and so can cause a NULL
pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 4a62ffd..4495b7b 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)
int i;
match = of_match_device(of_mtk_match, &pdev->dev);
+ if (!match) {
+ dev_err(&pdev->dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
soc = (struct mtk_soc_data *)match->data;
eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Net: ethernet: mediatek - Fix possible NULL derefrence.
@ 2017-01-27 12:44 ` Corentin Labbe
0 siblings, 0 replies; 8+ messages in thread
From: Corentin Labbe @ 2017-01-27 12:44 UTC (permalink / raw)
To: Shailendra Verma
Cc: Felix Fietkau, John Crispin, Matthias Brugger, netdev,
linux-arm-kernel, linux-mediatek, linux-kernel, p.shailesh,
ashish.kalra, Shailendra Verma
On Fri, Jan 27, 2017 at 04:49:40PM +0530, Shailendra Verma wrote:
> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
>
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 4a62ffd..4495b7b 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)
> int i;
>
> match = of_match_device(of_mtk_match, &pdev->dev);
> + if (!match) {
> + dev_err(&pdev->dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> soc = (struct mtk_soc_data *)match->data;
>
> eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
> --
Hello
You could use of_device_get_match_data() and simplifiy code
Regards
Corentin Labbe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Net: ethernet: mediatek - Fix possible NULL derefrence.
@ 2017-01-27 12:44 ` Corentin Labbe
0 siblings, 0 replies; 8+ messages in thread
From: Corentin Labbe @ 2017-01-27 12:44 UTC (permalink / raw)
To: Shailendra Verma
Cc: Felix Fietkau, ashish.kalra-Sze3O3UU22JBDgjK7y7TUQ,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
p.shailesh-Sze3O3UU22JBDgjK7y7TUQ,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
Matthias Brugger, Shailendra Verma,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, John Crispin
On Fri, Jan 27, 2017 at 04:49:40PM +0530, Shailendra Verma wrote:
> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
>
> Signed-off-by: Shailendra Verma <shailendra.v-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 4a62ffd..4495b7b 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)
> int i;
>
> match = of_match_device(of_mtk_match, &pdev->dev);
> + if (!match) {
> + dev_err(&pdev->dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> soc = (struct mtk_soc_data *)match->data;
>
> eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
> --
Hello
You could use of_device_get_match_data() and simplifiy code
Regards
Corentin Labbe
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Net: ethernet: mediatek - Fix possible NULL derefrence.
@ 2017-01-27 12:44 ` Corentin Labbe
0 siblings, 0 replies; 8+ messages in thread
From: Corentin Labbe @ 2017-01-27 12:44 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jan 27, 2017 at 04:49:40PM +0530, Shailendra Verma wrote:
> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
>
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 4a62ffd..4495b7b 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)
> int i;
>
> match = of_match_device(of_mtk_match, &pdev->dev);
> + if (!match) {
> + dev_err(&pdev->dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> soc = (struct mtk_soc_data *)match->data;
>
> eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
> --
Hello
You could use of_device_get_match_data() and simplifiy code
Regards
Corentin Labbe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Net: ethernet: mediatek - Fix possible NULL derefrence.
2017-01-27 12:44 ` Corentin Labbe
(?)
@ 2017-01-27 16:26 ` David Miller
-1 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-01-27 16:26 UTC (permalink / raw)
To: clabbe.montjoie
Cc: shailendra.v, nbd, blogic, matthias.bgg, netdev,
linux-arm-kernel, linux-mediatek, linux-kernel, p.shailesh,
ashish.kalra, shailendra.capricorn
From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: Fri, 27 Jan 2017 13:44:49 +0100
> On Fri, Jan 27, 2017 at 04:49:40PM +0530, Shailendra Verma wrote:
>> of_match_device could return NULL, and so can cause a NULL
>> pointer dereference later.
>>
>> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
>> ---
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> index 4a62ffd..4495b7b 100644
>> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> @@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)
>> int i;
>>
>> match = of_match_device(of_mtk_match, &pdev->dev);
>> + if (!match) {
>> + dev_err(&pdev->dev, "Error: No device match found\n");
>> + return -ENODEV;
>> + }
>> soc = (struct mtk_soc_data *)match->data;
>>
>> eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
>> --
>
> Hello
>
> You could use of_device_get_match_data() and simplifiy code
Agreed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Net: ethernet: mediatek - Fix possible NULL derefrence.
@ 2017-01-27 16:26 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-01-27 16:26 UTC (permalink / raw)
To: clabbe.montjoie
Cc: nbd, ashish.kalra, netdev, linux-kernel, p.shailesh,
linux-mediatek, shailendra.v, matthias.bgg, shailendra.capricorn,
linux-arm-kernel, blogic
From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: Fri, 27 Jan 2017 13:44:49 +0100
> On Fri, Jan 27, 2017 at 04:49:40PM +0530, Shailendra Verma wrote:
>> of_match_device could return NULL, and so can cause a NULL
>> pointer dereference later.
>>
>> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
>> ---
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> index 4a62ffd..4495b7b 100644
>> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> @@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)
>> int i;
>>
>> match = of_match_device(of_mtk_match, &pdev->dev);
>> + if (!match) {
>> + dev_err(&pdev->dev, "Error: No device match found\n");
>> + return -ENODEV;
>> + }
>> soc = (struct mtk_soc_data *)match->data;
>>
>> eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
>> --
>
> Hello
>
> You could use of_device_get_match_data() and simplifiy code
Agreed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Net: ethernet: mediatek - Fix possible NULL derefrence.
@ 2017-01-27 16:26 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-01-27 16:26 UTC (permalink / raw)
To: linux-arm-kernel
From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: Fri, 27 Jan 2017 13:44:49 +0100
> On Fri, Jan 27, 2017 at 04:49:40PM +0530, Shailendra Verma wrote:
>> of_match_device could return NULL, and so can cause a NULL
>> pointer dereference later.
>>
>> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
>> ---
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> index 4a62ffd..4495b7b 100644
>> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> @@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)
>> int i;
>>
>> match = of_match_device(of_mtk_match, &pdev->dev);
>> + if (!match) {
>> + dev_err(&pdev->dev, "Error: No device match found\n");
>> + return -ENODEV;
>> + }
>> soc = (struct mtk_soc_data *)match->data;
>>
>> eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
>> --
>
> Hello
>
> You could use of_device_get_match_data() and simplifiy code
Agreed.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-01-27 16:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20170127111947epcas2p14f5ea86f0069142be02339754fda4a55@epcas2p1.samsung.com>
2017-01-27 11:19 ` [PATCH] Net: ethernet: mediatek - Fix possible NULL derefrence Shailendra Verma
2017-01-27 11:19 ` Shailendra Verma
2017-01-27 12:44 ` Corentin Labbe
2017-01-27 12:44 ` Corentin Labbe
2017-01-27 12:44 ` Corentin Labbe
2017-01-27 16:26 ` David Miller
2017-01-27 16:26 ` David Miller
2017-01-27 16:26 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.