mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/gk20a/fb: fix NULL dereference
@ 2014-05-09  7:57 Alexandre Courbot
  2014-05-09 23:49 ` [Nouveau] " Ben Skeggs
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Courbot @ 2014-05-09  7:57 UTC (permalink / raw)
  To: Ben Skeggs
  Cc: Thierry Reding, nouveau, dri-devel, linux-tegra, linux-kernel,
	gnurou, Alexandre Courbot

gk20a_ram_put() can be called with a NULL nouveau_mem in case of error.
Handle that case the way is it done in other RAM drivers.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
index 403c88f07b99..7effd1a63458 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
@@ -36,6 +36,8 @@ gk20a_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
 	int i;
 
 	*pmem = NULL;
+	if (unlikely(mem == NULL))
+		return;
 
 	for (i = 0; i < mem->size; i++) {
 		struct page *page;
-- 
1.9.2


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

* Re: [Nouveau] [PATCH] drm/gk20a/fb: fix NULL dereference
  2014-05-09  7:57 [PATCH] drm/gk20a/fb: fix NULL dereference Alexandre Courbot
@ 2014-05-09 23:49 ` Ben Skeggs
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Skeggs @ 2014-05-09 23:49 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Ben Skeggs, nouveau, linux-kernel, dri-devel, linux-tegra

On Fri, May 9, 2014 at 5:57 PM, Alexandre Courbot <acourbot@nvidia.com> wrote:
> gk20a_ram_put() can be called with a NULL nouveau_mem in case of error.
> Handle that case the way is it done in other RAM drivers.
Got it, thanks!

>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
>  drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
> index 403c88f07b99..7effd1a63458 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
> @@ -36,6 +36,8 @@ gk20a_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
>         int i;
>
>         *pmem = NULL;
> +       if (unlikely(mem == NULL))
> +               return;
>
>         for (i = 0; i < mem->size; i++) {
>                 struct page *page;
> --
> 1.9.2
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau

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

end of thread, other threads:[~2014-05-09 23:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-09  7:57 [PATCH] drm/gk20a/fb: fix NULL dereference Alexandre Courbot
2014-05-09 23:49 ` [Nouveau] " Ben Skeggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®