You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
net: ll_temac: check the return value of devm_kmalloc()
commitb352c3465bupstream. devm_kmalloc() returns a pointer to allocated memory on success, NULL on failure. While lp->indirect_lock is allocated by devm_kmalloc() without proper check. It is better to check the value of it to prevent potential wrong memory access. Fixes:f14f5c11f0("net: ll_temac: Support indirect_mutex share within TEMAC IP") Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0fc1847359
commit
550d98ab30
@@ -1421,6 +1421,8 @@ static int temac_probe(struct platform_device *pdev)
|
||||
lp->indirect_lock = devm_kmalloc(&pdev->dev,
|
||||
sizeof(*lp->indirect_lock),
|
||||
GFP_KERNEL);
|
||||
if (!lp->indirect_lock)
|
||||
return -ENOMEM;
|
||||
spin_lock_init(lp->indirect_lock);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user