From: Markus Elfring elfring@users.sourceforge.net Date: Wed, 19 Nov 2014 17:50:19 +0100
The vfree() function performes also input parameter validation. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 14b2f50..f9a67b8 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -889,8 +889,7 @@ static int vmw_driver_unload(struct drm_device *dev)
if (dev_priv->ctx.res_ht_initialized) drm_ht_remove(&dev_priv->ctx.res_ht); - if (dev_priv->ctx.cmd_bounce) - vfree(dev_priv->ctx.cmd_bounce); + vfree(dev_priv->ctx.cmd_bounce); if (dev_priv->enable_fb) { vmw_fb_close(dev_priv); vmw_kms_restore_vga(dev_priv);
On November 19, 2014 5:57:13 PM SF Markus Elfring elfring@users.sourceforge.net wrote:
From: Markus Elfring elfring@users.sourceforge.net Date: Wed, 19 Nov 2014 17:50:19 +0100
The vfree() function performes also input parameter validation. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 14b2f50..f9a67b8 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -889,8 +889,7 @@ static int vmw_driver_unload(struct drm_device *dev)
if (dev_priv->ctx.res_ht_initialized) drm_ht_remove(&dev_priv->ctx.res_ht);
- if (dev_priv->ctx.cmd_bounce)
vfree(dev_priv->ctx.cmd_bounce);
- vfree(dev_priv->ctx.cmd_bounce); if (dev_priv->enable_fb) { vmw_fb_close(dev_priv); vmw_kms_restore_vga(dev_priv);
Reviewed-by: Thierry Reding thierry.reding@gmail.com
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 6 Jul 2015 09:49:11 +0200
The vfree() function performs also input parameter validation. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 654c8da..f718a6d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -2292,9 +2292,7 @@ static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, (sw_context->cmd_bounce_size >> 1)); }
- if (sw_context->cmd_bounce != NULL) - vfree(sw_context->cmd_bounce); - + vfree(sw_context->cmd_bounce); sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size);
if (sw_context->cmd_bounce == NULL) {
On Mon, Jul 6, 2015 at 4:01 PM, SF Markus Elfring < elfring@users.sourceforge.net> wrote:
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 6 Jul 2015 09:49:11 +0200
The vfree() function performs also input parameter validation. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net
Reviewed-by: Zhao Junwang zhjwpku@gmail.com
kfree will check that.
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 654c8da..f718a6d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -2292,9 +2292,7 @@ static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, (sw_context->cmd_bounce_size >> 1)); }
if (sw_context->cmd_bounce != NULL)
vfree(sw_context->cmd_bounce);
vfree(sw_context->cmd_bounce); sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); if (sw_context->cmd_bounce == NULL) {
-- 2.4.5
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by: Zhao Junwang zhjwpku@gmail.com
kfree will check that.
How does this feedback fit to a check before a call of the vfree() function?
Regards, Markus
On Thu, Jul 9, 2015 at 12:55 AM, SF Markus Elfring < elfring@users.sourceforge.net> wrote:
Reviewed-by: Zhao Junwang zhjwpku@gmail.com
kfree will check that.
How does this feedback fit to a check before a call of the vfree() function?
I might have made a mistake, the ctl^] lead me to the vfree in mm/nommu.c,
there is also a vfree() function in mm/vmalloc.c.
Anyway, I think the catch is reasonable.
Regards, Markus
From: Markus Elfring elfring@users.sourceforge.net Date: Fri, 22 Jul 2016 13:31:00 +0200
The vfree() function performs also input parameter validation. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 1a1a87c..dc5beff 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -3625,9 +3625,7 @@ static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, (sw_context->cmd_bounce_size >> 1)); }
- if (sw_context->cmd_bounce != NULL) - vfree(sw_context->cmd_bounce); - + vfree(sw_context->cmd_bounce); sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size);
if (sw_context->cmd_bounce == NULL) {
On Fri, Jul 22, 2016 at 7:45 AM, SF Markus Elfring elfring@users.sourceforge.net wrote:
From: Markus Elfring elfring@users.sourceforge.net Date: Fri, 22 Jul 2016 13:31:00 +0200
The vfree() function performs also input parameter validation. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net
Applied to drm-misc
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 1a1a87c..dc5beff 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -3625,9 +3625,7 @@ static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, (sw_context->cmd_bounce_size >> 1)); }
if (sw_context->cmd_bounce != NULL)
vfree(sw_context->cmd_bounce);
vfree(sw_context->cmd_bounce); sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); if (sw_context->cmd_bounce == NULL) {
-- 2.9.2
dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Looks good. Thanks!
Reviewed-by: Sinclair Yeh syeh@vmware.com
On Fri, Jul 22, 2016 at 01:45:40PM +0200, SF Markus Elfring wrote:
From: Markus Elfring elfring@users.sourceforge.net Date: Fri, 22 Jul 2016 13:31:00 +0200
The vfree() function performs also input parameter validation. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 1a1a87c..dc5beff 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -3625,9 +3625,7 @@ static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, (sw_context->cmd_bounce_size >> 1)); }
- if (sw_context->cmd_bounce != NULL)
vfree(sw_context->cmd_bounce);
vfree(sw_context->cmd_bounce); sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size);
if (sw_context->cmd_bounce == NULL) {
-- 2.9.2
dri-devel@lists.freedesktop.org