Skip to content

Commit 7878dca

Browse files
ArvindYadavCsgregkh
authored andcommitted
drm/sti: sti_vtg: Handle return NULL error from devm_ioremap_nocache
[ Upstream commit 1ae0d5af347df224a6e76334683f13a96d915a44 ] Here, If devm_ioremap_nocache will fail. It will return NULL. Kernel can run into a NULL-pointer dereference. This error check will avoid NULL pointer dereference. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Acked-by: Vincent Abriou <vincent.abriou@st.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b9ea0af commit 7878dca

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/gpu/drm/sti/sti_vtg.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ static int vtg_probe(struct platform_device *pdev)
346346
return -ENOMEM;
347347
}
348348
vtg->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
349+
if (!vtg->regs) {
350+
DRM_ERROR("failed to remap I/O memory\n");
351+
return -ENOMEM;
352+
}
349353

350354
np = of_parse_phandle(pdev->dev.of_node, "st,slave", 0);
351355
if (np) {

0 commit comments

Comments
 (0)