From patchwork Fri Mar 17 11:15:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volker Lendecke X-Patchwork-Id: 13178919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C193DC6FD1D for ; Fri, 17 Mar 2023 11:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229488AbjCQLP7 (ORCPT ); Fri, 17 Mar 2023 07:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbjCQLPz (ORCPT ); Fri, 17 Mar 2023 07:15:55 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE73317CEA for ; Fri, 17 Mar 2023 04:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-Id:Date:Cc:To:From; bh=520otV0fl6ruNu3nsplI0Nj/cDIeqDOeqpQtnhOmWwY=; b=Q7MZ3vWRdpneWByKrxrcL66vpQ r0HDaq7+oIIjwk1JAsArk6EFdb2VqW9hcL+OUqBj6JlKpZYCtagG9WyGs4xBT2oNmJUyLyXzx5zQf r4OEdhpaqXHRb/mJoKYaZixxc9qhjhf0rPbr89CLUIsoum70fV5Aq+yFMTPM4E+cK0FKORRrI/7l/ OPGZEI8xg3/E8LmAJXfj28N2dzJ/ymWsDvjQj5y0fpXWMmGAnSlN50Q+vGBD15tPCVH7MBKh2Pd1Q EHSVb/Z0Ef4SUHQpccTyI/WnzYk0rd98HfBtF1LzLM5N1606AG6CmTZPCJDcPyb+/nFPoK+BWf5sn AlPFk9JZ4f+bY6iJHDi0wIa2+IZxZnu1+urZTEaJUs3eOCUJNl5G8sDuogwU2QQlsY5UKoyqTkGJ+ +5vT36LJV/S9QwbBnZLixQ9e+i9iXma0wyHWfORLiOekipdRAo0aY1YhxyEWUpC4KHBfGD0yQ+8iO 0DG4V6VwzApmxb8/pF1HwqWS; Received: from [2a01:4f8:252:410e::177:224] (port=37520 helo=atb-devel-224..) by hr2.samba.org with esmtp (Exim) id 1pd83n-003p4x-Q0; Fri, 17 Mar 2023 11:15:47 +0000 From: Volker Lendecke To: linux-cifs@vger.kernel.org Cc: Volker Lendecke Subject: [PATCH 1/7] cifs: Avoid a cast in add_lease_context() Date: Fri, 17 Mar 2023 11:15:22 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We have the correctly-typed struct smb2_create_req * available in the caller. Signed-off-by: Volker Lendecke --- fs/cifs/smb2pdu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 0e53265e1462..3eb745237459 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2148,10 +2148,11 @@ smb2_parse_contexts(struct TCP_Server_Info *server, } static int -add_lease_context(struct TCP_Server_Info *server, struct kvec *iov, +add_lease_context(struct TCP_Server_Info *server, + struct smb2_create_req *req, + struct kvec *iov, unsigned int *num_iovec, u8 *lease_key, __u8 *oplock) { - struct smb2_create_req *req = iov[0].iov_base; unsigned int num = *num_iovec; iov[num].iov_base = server->ops->create_lease_buf(lease_key, *oplock); @@ -2833,7 +2834,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, (oparms->create_options & CREATE_NOT_FILE)) req->RequestedOplockLevel = *oplock; /* no srv lease support */ else { - rc = add_lease_context(server, iov, &n_iov, + rc = add_lease_context(server, req, iov, &n_iov, oparms->fid->lease_key, oplock); if (rc) return rc; From patchwork Fri Mar 17 11:15:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volker Lendecke X-Patchwork-Id: 13178921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58013C74A5B for ; Fri, 17 Mar 2023 11:16:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229634AbjCQLQB (ORCPT ); Fri, 17 Mar 2023 07:16:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229532AbjCQLPz (ORCPT ); Fri, 17 Mar 2023 07:15:55 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE5DD5FEB for ; Fri, 17 Mar 2023 04:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-Id:Date:Cc:To:From; bh=S+KORE2Zpa300f7YKiwwFzJhDSXNzdqgEmQ6HLKzXIc=; b=tIWkKwtpWE5h8e93bxec91c53c m15LBQzPl5dewalS2FLJia/EKljXpVKj5zRLcb33MJKKcW8zBFBWQTvSRVUkoh60qu+7aptxZlpNA azhWeha5QgS6HiAJminvZmVW0tJS8YCBGuAQREu+ElYRV9/+VHs9URwpGM+i3fqohEbGhVzFbaJdJ qQdK9NuW+cVVVKPIYltmnZ+O3jUqQ0MhHyu0x4S4h6XlFxyPjo0TGBS8OZgtP5GZAsRu7rD6DJaN5 vUZAnD+dalZOz6W026/yiqn3svlPI0qeLdoWrIqwGLMGYKSlEvTCzx/MitvVzSrMidpxD2fQmcgMg w6vfZTZ2bRWV9zQWr1/zRZ0BuZyb8zzvUSPHATvBSqI698reWVPA9eHQeuRXIctSiQN4Cae9fE1mn RmBU0ez9ry3u5t5kN23fVNe1RtXcqXB0rHuhdCh/V+u2pMmGG5JLz3dZTQheShRZ1z4gTxMNWjNnX dghXoXK0XhZUgBBU7KVWn6HM; Received: from [2a01:4f8:252:410e::177:224] (port=37520 helo=atb-devel-224..) by hr2.samba.org with esmtp (Exim) id 1pd83n-003p4x-Vc; Fri, 17 Mar 2023 11:15:48 +0000 From: Volker Lendecke To: linux-cifs@vger.kernel.org Cc: Volker Lendecke Subject: [PATCH 2/7] cifs: Avoid a cast in add_durable_context() Date: Fri, 17 Mar 2023 11:15:23 +0000 Message-Id: <01742c6a372345dce723d3511a41d21753b8aeee.1679051552.git.vl@samba.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We have the correctly-typed struct smb2_create_req * available in the caller. Signed-off-by: Volker Lendecke --- fs/cifs/smb2pdu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 3eb745237459..cebb8d9837d2 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2285,10 +2285,10 @@ add_durable_reconnect_v2_context(struct kvec *iov, unsigned int *num_iovec, } static int -add_durable_context(struct kvec *iov, unsigned int *num_iovec, +add_durable_context(struct smb2_create_req *req, + struct kvec *iov, unsigned int *num_iovec, struct cifs_open_parms *oparms, bool use_persistent) { - struct smb2_create_req *req = iov[0].iov_base; unsigned int num = *num_iovec; if (use_persistent) { @@ -2849,7 +2849,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, cpu_to_le32(server->vals->create_lease_size); } - rc = add_durable_context(iov, &n_iov, oparms, + rc = add_durable_context(req, iov, &n_iov, oparms, tcon->use_persistent); if (rc) return rc; From patchwork Fri Mar 17 11:15:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volker Lendecke X-Patchwork-Id: 13178916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04097C7618B for ; Fri, 17 Mar 2023 11:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229590AbjCQLP4 (ORCPT ); Fri, 17 Mar 2023 07:15:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjCQLPz (ORCPT ); Fri, 17 Mar 2023 07:15:55 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 294D43B21D for ; Fri, 17 Mar 2023 04:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-Id:Date:Cc:To:From; bh=BzNjhH9ScODyxjxIjrrBhUvgn9xEEkoimnXm3TQJdAo=; b=Rjwgz9zizpAeOU35055wAln+L2 44huYE/+zO0ObjYnX0RtPlwkX5MaPRpQ2J0O3apNC/+2khwV8+4828H2WaMqp62h8mFawkum4ZK5E sl5IyK4y8wxgCsOGZOrP3Y0YwkLuM4Y5J9SpXzb+I73LHouNmEKbUAs5Nhq8rpt73LSQB1ww356+J vAk2FB2MxveZegO/HdOjRAzzjEVfACQwrahdD4voEZI9DoCMTiqVmU8KW2NxZrITQTzkBxHgTF+Gh oXKzBtZZksfL75Usc6U1wzW6o2DBgNoQqOQ5wsNJzPppq1LlMEFkyXkX5RXOOSxqMyFuydkRIFzI5 nQTcMMD0vrrtiitL0pajOTqy02rq+Ajq7QGrQpCgrQ3gLl8898N0dVhWYbg/bH8YNDKtpmIUPbmDL 2EVV6satvDWCJ+NLhgqz7aj4yngj/Nb1iWcfKZB9qXqP3kkQ85z5a76i4zXx3vOdvQA/OvD9XRa39 F8bDzoapxcd3FM8CMcn2txoW; Received: from [2a01:4f8:252:410e::177:224] (port=37520 helo=atb-devel-224..) by hr2.samba.org with esmtp (Exim) id 1pd83o-003p4x-6G; Fri, 17 Mar 2023 11:15:48 +0000 From: Volker Lendecke To: linux-cifs@vger.kernel.org Cc: Volker Lendecke Subject: [PATCH 3/7] cifs: Avoid a cast in add_posix_context() Date: Fri, 17 Mar 2023 11:15:24 +0000 Message-Id: <7344eac4bab0f3d162ca5a401d9620d468ea3292.1679051552.git.vl@samba.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We have the correctly-typed struct smb2_create_req * available in the caller. Signed-off-by: Volker Lendecke --- fs/cifs/smb2pdu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index cebb8d9837d2..6b6790d8d0ee 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -795,9 +795,9 @@ create_posix_buf(umode_t mode) } static int -add_posix_context(struct kvec *iov, unsigned int *num_iovec, umode_t mode) +add_posix_context(struct smb2_create_req *req, + struct kvec *iov, unsigned int *num_iovec, umode_t mode) { - struct smb2_create_req *req = iov[0].iov_base; unsigned int num = *num_iovec; iov[num].iov_base = create_posix_buf(mode); @@ -2694,7 +2694,7 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, if (tcon->posix_extensions) { /* resource #3: posix buf */ - rc = add_posix_context(iov, &n_iov, mode); + rc = add_posix_context(req, iov, &n_iov, mode); if (rc) goto err_free_req; pc_buf = iov[n_iov-1].iov_base; @@ -2863,7 +2863,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, cpu_to_le32(iov[n_iov-1].iov_len); } - rc = add_posix_context(iov, &n_iov, oparms->mode); + rc = add_posix_context(req, iov, &n_iov, oparms->mode); if (rc) return rc; } From patchwork Fri Mar 17 11:15:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volker Lendecke X-Patchwork-Id: 13178922 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6371C761A6 for ; Fri, 17 Mar 2023 11:16:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229532AbjCQLQC (ORCPT ); Fri, 17 Mar 2023 07:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbjCQLP5 (ORCPT ); Fri, 17 Mar 2023 07:15:57 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E9F442EA for ; Fri, 17 Mar 2023 04:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-Id:Date:Cc:To:From; bh=QiQkInIdAMivDawkI7nXi9zVQPJVBBtqwak6lqEcqDg=; b=wJxa4dS1oSBVd20LienN9OgHIY 1Ff/ZOCNVOV7pIjRWPDxgvEGVyXy4TP4GjaJxDK2hB3DoVL++w8xzpP4nt6GxJnpwKeC9vFGfIwfk 2LBcUM5l3nTTatUQQsci86zl80dT0sHH1RmkPfzKB9tFW9OgUfw+jcizijT6DlfRYqhTfTtLollsT HXnuYbjof2j6ryj+H0IDymdttKEUbQnESQEuX4uxmvuW+evzNQzwgZaaECHkDMEA1L2VHne4VSIIu xIQNBmZLRTbWeLordFlrIV8hWweuVWvBgNyerKfDmjNZibcWweZXtKCZKtHH++nZNn8leWU0zoC2N dAsrCXPVIHzrU/8SK6JxVuyTcfzACz9DOEpqL88z1JWDE5isVZxU8qg83pUQPvtzANlKGIFOeQPDu s909moXHYKXk/o40APvN3m1jNJDaRSv0iqsIRLDCzKQ6u3U+BOSWi+J7hMVFNQiyg4EB01IRfJubn 954u7brgUDehJ1MyUC4iIOED; Received: from [2a01:4f8:252:410e::177:224] (port=37520 helo=atb-devel-224..) by hr2.samba.org with esmtp (Exim) id 1pd83o-003p4x-CI; Fri, 17 Mar 2023 11:15:48 +0000 From: Volker Lendecke To: linux-cifs@vger.kernel.org Cc: Volker Lendecke Subject: [PATCH 4/7] cifs: Avoid a cast in add_sd_context() Date: Fri, 17 Mar 2023 11:15:25 +0000 Message-Id: <8d0f4a2c9c860a89bde3d172bd5fccbdbc26b8bb.1679051552.git.vl@samba.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We have the correctly-typed struct smb2_create_req * available in the caller. Signed-off-by: Volker Lendecke --- 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; } From patchwork Fri Mar 17 11:15:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volker Lendecke X-Patchwork-Id: 13178920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E156AC7618B for ; Fri, 17 Mar 2023 11:16:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229603AbjCQLQA (ORCPT ); Fri, 17 Mar 2023 07:16:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbjCQLPz (ORCPT ); Fri, 17 Mar 2023 07:15:55 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74C294DBD0 for ; Fri, 17 Mar 2023 04:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-Id:Date:Cc:To:From; bh=AaQ2ehI8xzojdsdE7qs7SRgxVJu6qK7rBlsn99MWtAE=; b=DYUM9HlSQ4p1Xdew48KMh7C7I9 PCYtDuh21MWXSyXAiWddJpZBeX7OvpMHg6TD4KH/wHZZ2CY06ch8M3iNcGqQZQaB7pFYC3vpgObeR y8RsKEFT26SmXlj/h8jtJvrj0fwj0E4dJMHtxbv7SRnQCOXh1b167xm3vLoWZgtx/WVU7ZXCsv4ku nd8c4Q1OqUr8iC87ifhxDWPK0pTIDyi8r9VlkuIG4tTlcl05BKSJUfCWjIbp6QZrzmZ5oUi4Buw5j 3BISiRehvAlIjhIeuhzfvkvZKwkcI3rND307xFkUzI93LyBx5j/DHCHUQd2YQVI4GGKi0mLjYqnLG LA2yi6nHnMpD+CXzjJwK+qKBaS7FqTkC2NVUov3z5FuG3NjEvSQSMbV9zpH8d6RQMi6tVa0llqRbp 3anjXfiBv29sQOwklxcDYMsMhCxY3ev7V/bRFeK09Lnw7Hgu3YUjelg7nclFVIn84X/q5qwoVpPyr UXmxx/pGHgx/hx1adgGKiaGU; Received: from [2a01:4f8:252:410e::177:224] (port=37520 helo=atb-devel-224..) by hr2.samba.org with esmtp (Exim) id 1pd83o-003p4x-Fn; Fri, 17 Mar 2023 11:15:48 +0000 From: Volker Lendecke To: linux-cifs@vger.kernel.org Cc: Volker Lendecke Subject: [PATCH 5/7] cifs: Avoid a cast in add_durable_v2_context() Date: Fri, 17 Mar 2023 11:15:26 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We have the correctly-typed struct smb2_create_req * available in the caller. Signed-off-by: Volker Lendecke --- fs/cifs/smb2pdu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 91fc0ad3e1b4..6d4a14efa79f 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2241,10 +2241,10 @@ create_reconnect_durable_v2_buf(struct cifs_fid *fid) } static int -add_durable_v2_context(struct kvec *iov, unsigned int *num_iovec, +add_durable_v2_context(struct smb2_create_req *req, + struct kvec *iov, unsigned int *num_iovec, struct cifs_open_parms *oparms) { - struct smb2_create_req *req = iov[0].iov_base; unsigned int num = *num_iovec; iov[num].iov_base = create_durable_v2_buf(oparms); @@ -2296,7 +2296,8 @@ add_durable_context(struct smb2_create_req *req, return add_durable_reconnect_v2_context(iov, num_iovec, oparms); else - return add_durable_v2_context(iov, num_iovec, oparms); + return add_durable_v2_context(req, iov, num_iovec, + oparms); } if (oparms->reconnect) { From patchwork Fri Mar 17 11:15:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volker Lendecke X-Patchwork-Id: 13178918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1B5EC76195 for ; Fri, 17 Mar 2023 11:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229530AbjCQLP7 (ORCPT ); Fri, 17 Mar 2023 07:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbjCQLP5 (ORCPT ); Fri, 17 Mar 2023 07:15:57 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 289BB4DE19 for ; Fri, 17 Mar 2023 04:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-Id:Date:Cc:To:From; bh=v+q5i6vrNO9Nw/a7tIgrYAXPnkqCk0gQ0rPEzPqZFRU=; b=filQbofNyKS09x9d3AT1lGLuJe 3qj+iIGNVTIjP+0QXWHsPGmsp7yDEy9ZyIR0PcsliSoh02CINgOrCkavylckPl2FqqIdeFbW0Uw+Q SQj4eqxzKS9k9sNHT4r6BmxZUpq5RPLOCy4MsJnrkdwB6lafTEd5dqSj6ROYFIzHn1FFwb/+JTOSW c9I2FHKDIo/9ucaRUU7xImUC+Xi4OedDV9k4vx/EXnC9LRVOqeGnRS3jCv7ByW4ekxr9cld+se1hp BtiIVJwcDnkcBUFrJB4xNrd4xXhGxclii8/LMSZvaP6XiLFGym9cfkQNdC/zJNS7/YUlEn53/P2Dd Xdalk70EFKv83h1Unnjzi8Qhp44Tx090X29ajm2yQyhIUM90+wH8wYhUe3o6yJhUOFbHn6/tO6sNo qqZy0pWb7A1LJTjPI1TlOlfNf5iA0lmuVcAtb5ce737JDqewog3TnxtHLafZpsJBx79mhhTjXhcoe diYzBMEhl8RhnW6Ypyg7Lk69; Received: from [2a01:4f8:252:410e::177:224] (port=37520 helo=atb-devel-224..) by hr2.samba.org with esmtp (Exim) id 1pd83o-003p4x-MI; Fri, 17 Mar 2023 11:15:48 +0000 From: Volker Lendecke To: linux-cifs@vger.kernel.org Cc: Volker Lendecke Subject: [PATCH 6/7] cifs: Avoid a cast in add_durable_reconnect_v2_context() Date: Fri, 17 Mar 2023 11:15:27 +0000 Message-Id: <598f783f2701a596fe8e4bbadf2fa6d97edd91cd.1679051552.git.vl@samba.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We have the correctly-typed struct smb2_create_req * available in the caller. Signed-off-by: Volker Lendecke --- fs/cifs/smb2pdu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 6d4a14efa79f..9e9267da28a2 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2261,10 +2261,10 @@ add_durable_v2_context(struct smb2_create_req *req, } static int -add_durable_reconnect_v2_context(struct kvec *iov, unsigned int *num_iovec, +add_durable_reconnect_v2_context(struct smb2_create_req *req, + struct kvec *iov, unsigned int *num_iovec, struct cifs_open_parms *oparms) { - struct smb2_create_req *req = iov[0].iov_base; unsigned int num = *num_iovec; /* indicate that we don't need to relock the file */ @@ -2293,7 +2293,8 @@ add_durable_context(struct smb2_create_req *req, if (use_persistent) { if (oparms->reconnect) - return add_durable_reconnect_v2_context(iov, num_iovec, + return add_durable_reconnect_v2_context(req, + iov, num_iovec, oparms); else return add_durable_v2_context(req, iov, num_iovec, From patchwork Fri Mar 17 11:15:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volker Lendecke X-Patchwork-Id: 13178917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23E34C76196 for ; Fri, 17 Mar 2023 11:16:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229560AbjCQLQA (ORCPT ); Fri, 17 Mar 2023 07:16:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbjCQLP5 (ORCPT ); Fri, 17 Mar 2023 07:15:57 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DBF35550C for ; Fri, 17 Mar 2023 04:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-Id:Date:Cc:To:From; bh=zQWewxIqdzIXhHn7HsZjdcXiI+j/t7AbiYxHsi/YCRk=; b=OpZVlBpAsgbA+rvmzwul10Pfd7 KsLm7IlLX/NzHFIPBX1CgMGaQkLCrQ6l3q3ACPngltCGUmmPjHaGhC9TlQBY5JC8KUM+CZMMtTgz/ 63T6zxaYGcRvjV/SzKW3TGs6ZfMgKvMk9J8+re+1wxBR9/PDjcK3LF1U5xkcxkqy1PkTNIp+4Nez8 fSUO4zE5/jmcLf0PZ39E1RgHr8QNlW4wFZHNI9nChHwmE1CxZLZOtmwD2VQa2qSJbay77/bNJRIc+ OPgPHTEnthbwZXo397hZSk3Nizaa4QpycVqg4d5dAOWzPgD83VDxJsFLeX+N7OUA7BoPw/Zq1iA79 UvrYh+XlsR+NqjZAqUdn4Fg8ZseMySN++C1bm1fb3ziiqaQTCNVSVJCG6sKAU0Q8aJGkmnJJzejZT uRy0CgPvCvl6ZhsBRePVc8utT1xpEgAxGYiszzpOJIOaqSrnQoSy3bqIUCxpP4UEoBsPo+S9jWg+l vCh0w9fpMBvmCC1MTl3Upz8l; Received: from [2a01:4f8:252:410e::177:224] (port=37520 helo=atb-devel-224..) by hr2.samba.org with esmtp (Exim) id 1pd83o-003p4x-S7; Fri, 17 Mar 2023 11:15:49 +0000 From: Volker Lendecke To: linux-cifs@vger.kernel.org Cc: Volker Lendecke Subject: [PATCH 7/7] cifs: Avoid a cast in add_query_id_context() Date: Fri, 17 Mar 2023 11:15:28 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We have the correctly-typed struct smb2_create_req * available in the caller. Signed-off-by: Volker Lendecke --- fs/cifs/smb2pdu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 9e9267da28a2..2ea7e211391f 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2524,9 +2524,9 @@ create_query_id_buf(void) /* See MS-SMB2 2.2.13.2.9 */ static int -add_query_id_context(struct kvec *iov, unsigned int *num_iovec) +add_query_id_context(struct smb2_create_req *req, + struct kvec *iov, unsigned int *num_iovec) { - struct smb2_create_req *req = iov[0].iov_base; unsigned int num = *num_iovec; iov[num].iov_base = create_query_id_buf(); @@ -2922,7 +2922,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, (struct create_context *)iov[n_iov-1].iov_base; ccontext->Next = cpu_to_le32(iov[n_iov-1].iov_len); } - add_query_id_context(iov, &n_iov); + add_query_id_context(req, iov, &n_iov); rqst->rq_nvec = n_iov; return 0;