smb3: must initialize two ACL struct fields to zero

commit f09bd695af upstream.

Coverity spotted that we were not initalizing Stbz1 and Stbz2 to
zero in create_sd_buf.

Addresses-Coverity: 1513848 ("Uninitialized scalar variable")
Cc: <stable@vger.kernel.org>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Steve French 2022-10-14 18:50:20 -05:00 коммит произвёл Greg Kroah-Hartman
Родитель adf428ae46
Коммит 73b8218ef4
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -2354,7 +2354,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
unsigned int acelen, acl_size, ace_count; unsigned int acelen, acl_size, ace_count;
unsigned int owner_offset = 0; unsigned int owner_offset = 0;
unsigned int group_offset = 0; unsigned int group_offset = 0;
struct smb3_acl acl; struct smb3_acl acl = {};
*len = roundup(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8); *len = roundup(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8);
@ -2427,6 +2427,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */ acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */
acl.AclSize = cpu_to_le16(acl_size); acl.AclSize = cpu_to_le16(acl_size);
acl.AceCount = cpu_to_le16(ace_count); acl.AceCount = cpu_to_le16(ace_count);
/* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */
memcpy(aclptr, &acl, sizeof(struct smb3_acl)); memcpy(aclptr, &acl, sizeof(struct smb3_acl));
buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd); buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd);