提交 712a9941 编写于 作者: N Namjae Jeon 提交者: Zhong Jinghua

cifsd: fix warning: variable 'total_ace_size' and 'posix_ccontext' set but not used

mainline inclusion
from mainline-5.15-rc1
commit 548e9ad3
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I60T7G
CVE: NA

Reference: https://git.kernel.org/torvalds/linux/c/548e9ad31739

-------------------------------

kernel test robot reported warnings:

   fs/cifsd/smbacl.c: In function 'parse_sec_desc':
>> fs/cifsd/smbacl.c:786:6: warning: variable 'total_ace_size' set but
not used [-Wunused-but-set-variable]
     786 |  int total_ace_size = 0, pntsd_type;
         |      ^~~~~~~~~~~~~~
Signed-off-by: NZhong Jinghua <zhongjinghua@huawei.com>
上级 7a6fea20
......@@ -3283,10 +3283,6 @@ int smb2_open(struct ksmbd_work *work)
}
if (posix_ctxt) {
struct create_context *posix_ccontext;
posix_ccontext = (struct create_context *)(rsp->Buffer +
le32_to_cpu(rsp->CreateContextsLength));
contxt_cnt++;
create_posix_rsp_buf(rsp->Buffer +
le32_to_cpu(rsp->CreateContextsLength),
......
......@@ -389,7 +389,8 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
return;
/* validate that we do not go past end of acl */
if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) {
if (end_of_acl <= (char *)pdacl ||
end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) {
ksmbd_err("ACL too small to parse DACL\n");
return;
}
......@@ -783,7 +784,7 @@ int parse_sec_desc(struct smb_ntsd *pntsd, int acl_len,
struct smb_acl *dacl_ptr; /* no need for SACL ptr */
char *end_of_acl = ((char *)pntsd) + acl_len;
__u32 dacloffset;
int total_ace_size = 0, pntsd_type;
int pntsd_type;
if (pntsd == NULL)
return -EIO;
......@@ -800,16 +801,7 @@ int parse_sec_desc(struct smb_ntsd *pntsd, int acl_len,
le32_to_cpu(pntsd->gsidoffset),
le32_to_cpu(pntsd->sacloffset), dacloffset);
if (dacloffset) {
if (end_of_acl <= (char *)dacl_ptr ||
end_of_acl < (char *)dacl_ptr + le16_to_cpu(dacl_ptr->size))
return -EIO;
total_ace_size =
le16_to_cpu(dacl_ptr->size) - sizeof(struct smb_acl);
}
pntsd_type = le16_to_cpu(pntsd->type);
if (!(pntsd_type & DACL_PRESENT)) {
ksmbd_debug(SMB, "DACL_PRESENT in DACL type is not set\n");
return rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册