All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 1/1] vduse: moving kvfree into caller
@ 2021-12-06  8:48 'Guanjun'
  0 siblings, 0 replies; only message in thread
From: 'Guanjun' @ 2021-12-06  8:48 UTC (permalink / raw)
  To: mst, xieyongji; +Cc: jasowang, virtualization, kernel-janitors

From: Guanjun <guanjun@linux.alibaba.com>

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

No functional change.

Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
---
 drivers/vdpa/vdpa_user/vduse_dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index c9204c62f339..477a5a592002 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-06  8:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-06  8:48 [PATCH V2 1/1] vduse: moving kvfree into caller 'Guanjun'

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.