linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v1] gpu: drm: sti: sti_vtg:- Handle return NULL error from devm_ioremap_nocache
@ 2016-12-21  5:30 Arvind Yadav
  2017-01-04  9:29 ` Vincent ABRIOU
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2016-12-21  5:30 UTC (permalink / raw)
  To: benjamin.gaignard, vincent.abriou, airlied; +Cc: dri-devel, linux-kernel

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>
---
 drivers/gpu/drm/sti/sti_vtg.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index a8882bd..c3d9c8a 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -429,6 +429,10 @@ static int vtg_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 	vtg->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
+	if (!vtg->regs) {
+		DRM_ERROR("failed to remap I/O memory\n");
+		return -ENOMEM;
+	}
 
 	np = of_parse_phandle(pdev->dev.of_node, "st,slave", 0);
 	if (np) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [v1] gpu: drm: sti: sti_vtg:- Handle return NULL error from devm_ioremap_nocache
  2016-12-21  5:30 [v1] gpu: drm: sti: sti_vtg:- Handle return NULL error from devm_ioremap_nocache Arvind Yadav
@ 2017-01-04  9:29 ` Vincent ABRIOU
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent ABRIOU @ 2017-01-04  9:29 UTC (permalink / raw)
  To: Arvind Yadav, benjamin.gaignard, airlied; +Cc: dri-devel, linux-kernel

Thanks for the patch.

Acked-by: Vincent Abriou <vincent.abriou@st.com>

I will take it for pull request that should be issued by the end of the 
week.

Vincent

On 12/21/2016 06:30 AM, Arvind Yadav wrote:
> 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>
> ---
>  drivers/gpu/drm/sti/sti_vtg.c |    4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
> index a8882bd..c3d9c8a 100644
> --- a/drivers/gpu/drm/sti/sti_vtg.c
> +++ b/drivers/gpu/drm/sti/sti_vtg.c
> @@ -429,6 +429,10 @@ static int vtg_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  	}
>  	vtg->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
> +	if (!vtg->regs) {
> +		DRM_ERROR("failed to remap I/O memory\n");
> +		return -ENOMEM;
> +	}
>
>  	np = of_parse_phandle(pdev->dev.of_node, "st,slave", 0);
>  	if (np) {
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-04 10:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21  5:30 [v1] gpu: drm: sti: sti_vtg:- Handle return NULL error from devm_ioremap_nocache Arvind Yadav
2017-01-04  9:29 ` Vincent ABRIOU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).