提交 a069dc42 编写于 作者: C Colin Ian King 提交者: Zheng Zengkai

usb: gadget: r8a66597: Add missing null check on return from platform_get_resource

stable inclusion
from stable-5.10.37
commit e38a77c48aa02e0d58a366466c430b8fd9efb887
bugzilla: 51868
CVE: NA

--------------------------------

[ Upstream commit 9c207609 ]

The call to platform_get_resource can potentially return a NULL pointer
on failure, so add this check and return -EINVAL if it fails.

Fixes: c4144247 ("usb: gadget: R8A66597 peripheral controller support.")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Dereference null return")
Link: https://lore.kernel.org/r/20210406184510.433497-1-colin.king@canonical.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 26ee5e56
......@@ -1849,6 +1849,8 @@ static int r8a66597_probe(struct platform_device *pdev)
return PTR_ERR(reg);
ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!ires)
return -EINVAL;
irq = ires->start;
irq_trigger = ires->flags & IRQF_TRIGGER_MASK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册