Skip to content

Commit a55a608

Browse files
mjbommarsmfrench
authored andcommitted
smb: client: scope end_of_dacl to CIFS_DEBUG2 use in parse_dacl
After validate_dacl() was factored out in commit 149822e5541c, the local end_of_dacl in parse_dacl() is only read by the dump_ace() call under #ifdef CONFIG_CIFS_DEBUG2. With CIFS_DEBUG2 off the variable is assigned but never used, which gcc -W=1 flags as -Wunused-but-set-variable. Remove the local and compute the end-of-dacl pointer inline at the single call site inside the existing CIFS_DEBUG2 guard. No functional change: when CIFS_DEBUG2 is enabled the argument value is identical to what the removed local carried; when CIFS_DEBUG2 is disabled the code was already dead. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: 149822e5541c ("smb: client: validate the whole DACL before rewriting it in cifsacl") Signed-off-by: Michael Bommarito <[email protected]> Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Steve French <[email protected]>
1 parent 17d912d commit a55a608

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/smb/client/cifsacl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
836836
int i;
837837
u16 num_aces = 0;
838838
int acl_size;
839-
char *acl_base, *end_of_dacl;
839+
char *acl_base;
840840
struct smb_ace **ppace;
841841

842842
/* BB need to add parm so we can store the SID BB */
@@ -860,7 +860,6 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
860860
user/group/other have no permissions */
861861
fattr->cf_mode &= ~(0777);
862862

863-
end_of_dacl = (char *)pdacl + le16_to_cpu(pdacl->size);
864863
acl_base = (char *)pdacl;
865864
acl_size = sizeof(struct smb_acl);
866865

@@ -876,7 +875,8 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
876875
ppace[i] = (struct smb_ace *) (acl_base + acl_size);
877876

878877
#ifdef CONFIG_CIFS_DEBUG2
879-
dump_ace(ppace[i], end_of_dacl);
878+
dump_ace(ppace[i],
879+
(char *)pdacl + le16_to_cpu(pdacl->size));
880880
#endif
881881
if (mode_from_special_sid &&
882882
ppace[i]->sid.num_subauth >= 3 &&

0 commit comments

Comments
 (0)