Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eee01c88 authored by Xiaoke Wang's avatar Xiaoke Wang Committed by Greg Kroah-Hartman
Browse files

net: ll_temac: check the return value of devm_kmalloc()



commit b352c3465bb808ab700d03f5bac2f7a6f37c5350 upstream.

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: f14f5c11 ("net: ll_temac: Support indirect_mutex share within TEMAC IP")
Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fc92a14f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1345,6 +1345,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);
	}