提交 6b5693f2 编写于 作者: K Kangjie Lu 提交者: Greg Kroah-Hartman

media: video-mux: fix null pointer dereferences

[ Upstream commit aeb0d0f581e2079868e64a2e5ee346d340376eae ]

devm_kcalloc may fail and return a null pointer. The fix returns
-ENOMEM upon failures to avoid null pointer dereferences.
Signed-off-by: NKangjie Lu <kjlu@umn.edu>
Reviewed-by: NPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 bc75207a
...@@ -365,9 +365,14 @@ static int video_mux_probe(struct platform_device *pdev) ...@@ -365,9 +365,14 @@ static int video_mux_probe(struct platform_device *pdev)
vmux->active = -1; vmux->active = -1;
vmux->pads = devm_kcalloc(dev, num_pads, sizeof(*vmux->pads), vmux->pads = devm_kcalloc(dev, num_pads, sizeof(*vmux->pads),
GFP_KERNEL); GFP_KERNEL);
if (!vmux->pads)
return -ENOMEM;
vmux->format_mbus = devm_kcalloc(dev, num_pads, vmux->format_mbus = devm_kcalloc(dev, num_pads,
sizeof(*vmux->format_mbus), sizeof(*vmux->format_mbus),
GFP_KERNEL); GFP_KERNEL);
if (!vmux->format_mbus)
return -ENOMEM;
for (i = 0; i < num_pads; i++) { for (i = 0; i < num_pads; i++) {
vmux->pads[i].flags = (i < num_pads - 1) ? MEDIA_PAD_FL_SINK vmux->pads[i].flags = (i < num_pads - 1) ? MEDIA_PAD_FL_SINK
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册