linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: remove unnecessary copies of tcon->crfid.fid
@ 2021-04-13 23:25 Muhammad Usama Anjum
  2021-04-14 12:00 ` Aurélien Aptel
  0 siblings, 1 reply; 3+ messages in thread
From: Muhammad Usama Anjum @ 2021-04-13 23:25 UTC (permalink / raw)
  To: Steve French, Ronnie Sahlberg,
	open list:COMMON INTERNET FILE SYSTEM CLIENT (CIFS),
	moderated list:COMMON INTERNET FILE SYSTEM CLIENT (CIFS),
	open list
  Cc: musamaanjum, kernel-janitors, dan.carpenter, colin.king

pfid is being set to tcon->crfid.fid and they are copied in each other
multiple times. Remove the memcopy between same pointers.

Addresses-Coverity: ("Overlapped copy")
Fixes: 9e81e8ff74b9 ("cifs: return cached_fid from open_shroot")
Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
---
I'm not sure why refcount was being incremented here. This file has been
evoloved so much. Any ideas?

fs/cifs/smb2ops.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 61214b23c57f..6fa35003dcfe 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -847,14 +847,6 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
 			.volatile_fid = pfid->volatile_fid,
 		};
 
-		/*
-		 * caller expects this func to set pfid to a valid
-		 * cached root, so we copy the existing one and get a
-		 * reference.
-		 */
-		memcpy(pfid, tcon->crfid.fid, sizeof(*pfid));
-		kref_get(&tcon->crfid.refcount);
-
 		mutex_unlock(&tcon->crfid.fid_mutex);
 
 		if (rc == 0) {
@@ -885,7 +877,6 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
 	oparms.fid->mid = le64_to_cpu(o_rsp->sync_hdr.MessageId);
 #endif /* CIFS_DEBUG2 */
 
-	memcpy(tcon->crfid.fid, pfid, sizeof(struct cifs_fid));
 	tcon->crfid.tcon = tcon;
 	tcon->crfid.is_valid = true;
 	tcon->crfid.dentry = dentry;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-15 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-13 23:25 [PATCH] cifs: remove unnecessary copies of tcon->crfid.fid Muhammad Usama Anjum
2021-04-14 12:00 ` Aurélien Aptel
2021-04-15 14:52   ` Muhammad Usama Anjum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).