Skip to contentSkip to conversation

vduse: moving kvfree into caller

PATCH Superseded 'Guanjun' 2 participants 3 messages Dec 6, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

'Guanjun'

author
#0 lore raw

PATCH 1/1 vduse: moving kvfree into caller

From: Guanjun <[email protected]>

This free action should be moved into caller 'vduse_ioctl' in concert with the allocation.

No functional change.

Fixes c8a6153b6c59 ("vduse: Introduce VDUSE - vDPA Device in Userspace")
---
 drivers/vdpa/vdpa_user/vduse_dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vdpa/vdpa_user/vduse_dev.c +2 -1
index c9204c62f339..477a5a592002 100644
@@ -1355,7 +1355,6 @@ static int vduse_create_dev(struct vduse_dev_config *config,
 err_str:
 	vduse_dev_destroy(dev);
 err:
-	kvfree(config_buf);
 	return ret;
 }
 
@@ -1406,6 +1405,8 @@ static long vduse_ioctl(struct file *file, unsigned int cmd,
 		}
 		config.name[VDUSE_NAME_MAX - 1] = '\0';
 		ret = vduse_create_dev(&config, buf, control->api_version);
+		if (ret)
+			kvfree(buf);
 		break;
 	}
 	case VDUSE_DESTROY_DEV: {
Signature · 1 line
2.27.0
#1 lore raw
Quoted 9 lines · Guanjun

From: Guanjun <[email protected]>

This free action should be moved into caller 'vduse_ioctl' in concert with the allocation.

No functional change.

Fixes c8a6153b6c59 ("vduse: Introduce VDUSE - vDPA Device in Userspace")

Does this fix a real problem? If not, let's try not using fixes tags here.

Thanks

Quoted 29 lines
---
 drivers/vdpa/vdpa_user/vduse_dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vdpa/vdpa_user/vduse_dev.c +2 -2
index c9204c62f339..477a5a592002 100644
@@ -1355,7 +1355,6 @@ static int vduse_create_dev(struct vduse_dev_config *config,
 err_str:
        vduse_dev_destroy(dev);
 err:
-       kvfree(config_buf);
        return ret;
 }
 
@@ -1406,6 +1405,8 @@ static long vduse_ioctl(struct file *file, unsigned int cmd,
                }
                config.name[VDUSE_NAME_MAX - 1] = '\0';
                ret = vduse_create_dev(&config, buf, control->api_version);
+               if (ret)
+                       kvfree(buf);
                break;
        }
        case VDUSE_DESTROY_DEV: {
--

2.27.0

author
#2 lore raw
Quoted 11 lines

2021年12月6日 下午4:00,Jason Wang <[email protected]> 写道:

Quoted 6 lines · Guanjun

From: Guanjun <[email protected]>

This free action should be moved into caller 'vduse_ioctl' in concert with the allocation.

Quoted 7 lines
Quoted 3 lines

No functional change.

Fixes c8a6153b6c59 ("vduse: Introduce VDUSE - vDPA Device in Userspace")

Does this fix a real problem? If not, let's try not using fixes tags here.

Thanks

This is not a bugfix, just a cleanup.
Will fix this.

Thanks for your reply.
Guanjun

Quoted 30 lines
Quoted 30 lines

---
drivers/vdpa/vdpa_user/vduse_dev.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vdpa/vdpa_user/vduse_dev.c +0 -0
index c9204c62f339..477a5a592002 100644
@@ -1355,7 +1355,6 @@ static int vduse_create_dev(struct vduse_dev_config *config,

err_str:

       vduse_dev_destroy(dev);
err:
-       kvfree(config_buf);
       return ret;
}
drivers/vdpa/vdpa_user/vduse_dev.c +2 -1
@@ -1406,6 +1405,8 @@ static long vduse_ioctl(struct file *file, unsigned int cmd,
               }
               config.name[VDUSE_NAME_MAX - 1] = '\0';
               ret = vduse_create_dev(&config, buf, control->api_version);
+               if (ret)
+                       kvfree(buf);
               break;
       }
       case VDUSE_DESTROY_DEV: {
--

2.27.0