[PATCH 4/7] cifs: Avoid a cast in add_sd_context()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We have the correctly-typed struct smb2_create_req * available in the
caller.

Signed-off-by: Volker Lendecke <vl@xxxxxxxxx>
---
 fs/cifs/smb2pdu.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 6b6790d8d0ee..91fc0ad3e1b4 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2344,9 +2344,9 @@ create_twarp_buf(__u64 timewarp)
 
 /* See MS-SMB2 2.2.13.2.7 */
 static int
-add_twarp_context(struct kvec *iov, unsigned int *num_iovec, __u64 timewarp)
+add_twarp_context(struct smb2_create_req *req,
+		  struct kvec *iov, unsigned int *num_iovec, __u64 timewarp)
 {
-	struct smb2_create_req *req = iov[0].iov_base;
 	unsigned int num = *num_iovec;
 
 	iov[num].iov_base = create_twarp_buf(timewarp);
@@ -2478,9 +2478,10 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
 }
 
 static int
-add_sd_context(struct kvec *iov, unsigned int *num_iovec, umode_t mode, bool set_owner)
+add_sd_context(struct smb2_create_req *req,
+	       struct kvec *iov, unsigned int *num_iovec, umode_t mode,
+	       bool set_owner)
 {
-	struct smb2_create_req *req = iov[0].iov_base;
 	unsigned int num = *num_iovec;
 	unsigned int len = 0;
 
@@ -2877,7 +2878,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
 				cpu_to_le32(iov[n_iov-1].iov_len);
 		}
 
-		rc = add_twarp_context(iov, &n_iov, tcon->snapshot_time);
+		rc = add_twarp_context(req, iov, &n_iov, tcon->snapshot_time);
 		if (rc)
 			return rc;
 	}
@@ -2907,7 +2908,8 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
 			}
 
 			cifs_dbg(FYI, "add sd with mode 0x%x\n", oparms->mode);
-			rc = add_sd_context(iov, &n_iov, oparms->mode, set_owner);
+			rc = add_sd_context(req, iov, &n_iov, oparms->mode,
+					    set_owner);
 			if (rc)
 				return rc;
 		}
-- 
2.30.2




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux