[PATCH] smb: client: Use common code in smb3_enum_snapshots()

Markus Elfring posted 1 patch 2 months, 1 week ago
fs/smb/client/smb2ops.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH] smb: client: Use common code in smb3_enum_snapshots()
Posted by Markus Elfring 2 months, 1 week ago
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Oct 2025 22:35:48 +0200

Use an additional label so that a bit of common code can be better reused
at the end of this function implementation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/client/smb2ops.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 7c3e96260fd4..6ca3046443c1 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -2301,8 +2301,7 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
 		if (copy_from_user(&snapshot_in, ioc_buf,
 		    sizeof(struct smb_snapshot_array))) {
 			rc = -EFAULT;
-			kfree(retbuf);
-			return rc;
+			goto free_buf;
 		}
 
 		/*
@@ -2329,7 +2328,7 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
 		if (copy_to_user(ioc_buf, retbuf, ret_data_len))
 			rc = -EFAULT;
 	}
-
+free_buf:
 	kfree(retbuf);
 	return rc;
 }
-- 
2.51.0