Skip to content

Commit f09bd69

Browse files
author
Steve French
committed
smb3: must initialize two ACL struct fields to zero
Coverity spotted that we were not initalizing Stbz1 and Stbz2 to zero in create_sd_buf. Addresses-Coverity: 1513848 ("Uninitialized scalar variable") Cc: <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent b854b4e commit f09bd69

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/cifs/smb2pdu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2420,7 +2420,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
24202420
unsigned int acelen, acl_size, ace_count;
24212421
unsigned int owner_offset = 0;
24222422
unsigned int group_offset = 0;
2423-
struct smb3_acl acl;
2423+
struct smb3_acl acl = {};
24242424

24252425
*len = round_up(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8);
24262426

@@ -2493,6 +2493,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
24932493
acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */
24942494
acl.AclSize = cpu_to_le16(acl_size);
24952495
acl.AceCount = cpu_to_le16(ace_count);
2496+
/* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */
24962497
memcpy(aclptr, &acl, sizeof(struct smb3_acl));
24972498

24982499
buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd);

0 commit comments

Comments
 (0)