Skip to contentSkip to conversation

smb: client: Use common code in smb3_enum_snapshots()

PATCH New Markus Elfring 1 participant 1 message Oct 8, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smb: client: Use common code in smb3_enum_snapshots()

From: Markus Elfring <[email protected]>
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.

---
 fs/smb/client/smb2ops.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/smb/client/smb2ops.c +2 -3
index 7c3e96260fd4..6ca3046443c1 100644
@@ -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;
 }
Signature · 1 line
2.51.0