linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm:vkms: Add NULL value after free function In function vkms_exit, after kfree(default_config), give specific NULL value to pointer default_config to avoid wild pointer.
@ 2021-05-12 11:55 Hao Peng
  2021-05-17 14:09 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Hao Peng @ 2021-05-12 11:55 UTC (permalink / raw)
  To: rodrigosiqueiramelo, melissa.srw, hamohammed.sa, daniel, airlied
  Cc: dri-devel, linux-kernel, Hao Peng

Signed-off-by: Hao Peng <penghaob@uniontech.com>
---
 drivers/gpu/drm/vkms/vkms_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 2173b82606f6..6c63201db5d0 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -227,6 +227,7 @@ static void __exit vkms_exit(void)
 		vkms_destroy(default_config);
 
 	kfree(default_config);
+	default_config = NULL;
 }
 
 module_init(vkms_init);
-- 
2.20.1




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

* Re: [PATCH] drm:vkms: Add NULL value after free function In function vkms_exit, after kfree(default_config), give specific NULL value to pointer default_config to avoid wild pointer.
  2021-05-12 11:55 [PATCH] drm:vkms: Add NULL value after free function In function vkms_exit, after kfree(default_config), give specific NULL value to pointer default_config to avoid wild pointer Hao Peng
@ 2021-05-17 14:09 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2021-05-17 14:09 UTC (permalink / raw)
  To: Hao Peng
  Cc: rodrigosiqueiramelo, melissa.srw, hamohammed.sa, daniel, airlied,
	dri-devel, linux-kernel

On Wed, May 12, 2021 at 07:55:54PM +0800, Hao Peng wrote:
> Signed-off-by: Hao Peng <penghaob@uniontech.com>
> ---
>  drivers/gpu/drm/vkms/vkms_drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index 2173b82606f6..6c63201db5d0 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -227,6 +227,7 @@ static void __exit vkms_exit(void)
>  		vkms_destroy(default_config);
>  
>  	kfree(default_config);
> +	default_config = NULL;

This is the last thing before the module us unloaded, which means no one
can access default_config anymore. So also no point in clearing it.
-Daniel

>  }
>  
>  module_init(vkms_init);
> -- 
> 2.20.1
> 
> 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

end of thread, other threads:[~2021-05-17 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 11:55 [PATCH] drm:vkms: Add NULL value after free function In function vkms_exit, after kfree(default_config), give specific NULL value to pointer default_config to avoid wild pointer Hao Peng
2021-05-17 14:09 ` Daniel Vetter

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).