diff options
author | Wei Yongjun <[email protected]> | 2020-04-29 02:52:20 +0000 |
---|---|---|
committer | David S. Miller <[email protected]> | 2020-05-01 15:27:09 -0700 |
commit | e00edb4efbbc07425441a3be2aa87abaf5800d96 (patch) | |
tree | 4be9a7c2f3e416eb5e80d793ccbb2fcafa1ef635 /tools/perf/scripts/python/check-perf-trace.py | |
parent | 41a46913bee76d8493681442907ccd989ced2633 (diff) |
drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_probe()
platform_get_resource() may fail and return NULL, so we should
better check it's return value to avoid a NULL pointer dereference
since devm_ioremap() does not check input parameters for null.
This is detected by Coccinelle semantic patch.
@@
expression pdev, res, n, t, e, e1, e2;
@@
res = \(platform_get_resource\|platform_get_resource_byname\)(pdev, t, n);
+ if (!res)
+ return -EINVAL;
... when != res == NULL
e = devm_ioremap(e1, res->start, e2);
Fixes: 03f66f067560 ("net: ethernet: ti: davinci_mdio: use devm_ioremap()")
Signed-off-by: Wei Yongjun <[email protected]>
Reviewed-by: Grygorii Strashko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/check-perf-trace.py')
0 files changed, 0 insertions, 0 deletions