summaryrefslogtreecommitdiffstats
path: root/fs/smb
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@manguebit.com>2023-08-17 12:34:12 -0300
committerSteve French <stfrench@microsoft.com>2023-08-20 16:05:50 -0500
commit933148a47c8b3db569cb92888571a57b8c171f3b (patch)
treee6376ef65eb59c644b439a6c978ecdb641cf86bb /fs/smb
parent946ad1b8b18dd91804e2dbfd9a9cefb6a8196bc0 (diff)
downloadlinux-stable-933148a47c8b3db569cb92888571a57b8c171f3b.tar.gz
linux-stable-933148a47c8b3db569cb92888571a57b8c171f3b.tar.bz2
linux-stable-933148a47c8b3db569cb92888571a57b8c171f3b.zip
smb: client: reduce stack usage in smb_send_rqst()
Clang warns about exceeded stack frame size fs/smb/client/transport.c:420:1: warning: stack frame size (1048) exceeds limit (1024) in 'smb_send_rqst' [-Wframe-larger-than] Fix this by allocating a structure that will hold transform header and compound requests. Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb')
-rw-r--r--fs/smb/client/transport.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
index f280502a2aee..1b5d9794ed5b 100644
--- a/fs/smb/client/transport.c
+++ b/fs/smb/client/transport.c
@@ -416,13 +416,19 @@ out:
return rc;
}
+struct send_req_vars {
+ struct smb2_transform_hdr tr_hdr;
+ struct smb_rqst rqst[MAX_COMPOUND];
+ struct kvec iov;
+};
+
static int
smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
struct smb_rqst *rqst, int flags)
{
- struct kvec iov;
- struct smb2_transform_hdr *tr_hdr;
- struct smb_rqst cur_rqst[MAX_COMPOUND];
+ struct send_req_vars *vars;
+ struct smb_rqst *cur_rqst;
+ struct kvec *iov;
int rc;
if (!(flags & CIFS_TRANSFORM_REQ))
@@ -436,16 +442,15 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
return -EIO;
}
- tr_hdr = kzalloc(sizeof(*tr_hdr), GFP_NOFS);
- if (!tr_hdr)
+ vars = kzalloc(sizeof(*vars), GFP_NOFS);
+ if (!vars)
return -ENOMEM;
+ cur_rqst = vars->rqst;
+ iov = &vars->iov;
- memset(&cur_rqst[0], 0, sizeof(cur_rqst));
- memset(&iov, 0, sizeof(iov));
-
- iov.iov_base = tr_hdr;
- iov.iov_len = sizeof(*tr_hdr);
- cur_rqst[0].rq_iov = &iov;
+ iov->iov_base = &vars->tr_hdr;
+ iov->iov_len = sizeof(vars->tr_hdr);
+ cur_rqst[0].rq_iov = iov;
cur_rqst[0].rq_nvec = 1;
rc = server->ops->init_transform_rq(server, num_rqst + 1,
@@ -456,7 +461,7 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
rc = __smb_send_rqst(server, num_rqst + 1, &cur_rqst[0]);
smb3_free_compound_rqst(num_rqst, &cur_rqst[1]);
out:
- kfree(tr_hdr);
+ kfree(vars);
return rc;
}