diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2021-05-26 17:57:12 +0900 |
---|---|---|
committer | Namjae Jeon <namjae.jeon@samsung.com> | 2021-05-26 18:13:51 +0900 |
commit | 070fb21e5912b6aa22509083aaca030d1f4e7d57 (patch) | |
tree | 2475744083730a8d5ef84cf343eced55dbfdc239 /fs/cifsd/smbacl.c | |
parent | fe30ea69ff81f99607b0e4002ef9ae12e4694b31 (diff) | |
download | lwn-070fb21e5912b6aa22509083aaca030d1f4e7d57.tar.gz lwn-070fb21e5912b6aa22509083aaca030d1f4e7d57.zip |
cifsd: Alignment should match open parenthesis
Fix warnings "Alignment should match open parenthesis" from
checkpatch.pl --strict.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifsd/smbacl.c')
-rw-r--r-- | fs/cifsd/smbacl.c | 106 |
1 files changed, 55 insertions, 51 deletions
diff --git a/fs/cifsd/smbacl.c b/fs/cifsd/smbacl.c index d65e853ab00f..63db8c015f9d 100644 --- a/fs/cifsd/smbacl.c +++ b/fs/cifsd/smbacl.c @@ -131,7 +131,7 @@ static void smb_copy_sid(struct smb_sid *dst, const struct smb_sid *src) * bits to set can be: S_IRWXU, S_IRWXG or S_IRWXO ie 00700 or 00070 or 00007 */ static umode_t access_flags_to_mode(struct smb_fattr *fattr, __le32 ace_flags, - int type) + int type) { __u32 flags = le32_to_cpu(ace_flags); umode_t mode = 0; @@ -166,7 +166,7 @@ static umode_t access_flags_to_mode(struct smb_fattr *fattr, __le32 ace_flags, * with either owner or group or everyone. */ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use, - __u32 *pace_flags) + __u32 *pace_flags) { /* reset access mask */ *pace_flags = 0x0; @@ -187,12 +187,12 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use, *pace_flags |= SET_FILE_EXEC_RIGHTS; ksmbd_debug(SMB, "mode: %o, access flags now 0x%x\n", - mode, *pace_flags); + mode, *pace_flags); } static __u16 fill_ace_for_sid(struct smb_ace *pntace, - const struct smb_sid *psid, int type, int flags, - umode_t mode, umode_t bits) + const struct smb_sid *psid, int type, int flags, + umode_t mode, umode_t bits) { int i; __u16 size = 0; @@ -255,7 +255,7 @@ void id_to_sid(unsigned int cid, uint sidtype, struct smb_sid *ssid) } static int sid_to_id(struct smb_sid *psid, uint sidtype, - struct smb_fattr *fattr) + struct smb_fattr *fattr) { int rc = -EINVAL; @@ -265,7 +265,7 @@ static int sid_to_id(struct smb_sid *psid, uint sidtype, */ if (unlikely(psid->num_subauth > SID_MAX_SUB_AUTHORITIES)) { ksmbd_err("%s: %u subauthorities is too many!\n", - __func__, psid->num_subauth); + __func__, psid->num_subauth); return -EIO; } @@ -299,7 +299,7 @@ static int sid_to_id(struct smb_sid *psid, uint sidtype, } void posix_state_to_acl(struct posix_acl_state *state, - struct posix_acl_entry *pace) + struct posix_acl_entry *pace) { int i; @@ -364,8 +364,8 @@ void free_acl_state(struct posix_acl_state *state) } static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, - struct smb_sid *pownersid, struct smb_sid *pgrpsid, - struct smb_fattr *fattr) + struct smb_sid *pownersid, struct smb_sid *pgrpsid, + struct smb_fattr *fattr) { int i, ret; int num_aces = 0; @@ -388,8 +388,8 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, } ksmbd_debug(SMB, "DACL revision %d size %d num aces %d\n", - le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), - le32_to_cpu(pdacl->num_aces)); + le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), + le32_to_cpu(pdacl->num_aces)); acl_base = (char *)pdacl; acl_size = sizeof(struct smb_acl); @@ -401,8 +401,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, if (num_aces > ULONG_MAX / sizeof(struct smb_ace *)) return; - ppace = kmalloc_array(num_aces, sizeof(struct smb_ace *), - GFP_KERNEL); + ppace = kmalloc_array(num_aces, sizeof(struct smb_ace *), GFP_KERNEL); if (!ppace) return; @@ -433,7 +432,8 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, break; } else if (!compare_sids(&ppace[i]->sid, pownersid)) { acl_mode = access_flags_to_mode(fattr, - ppace[i]->access_req, ppace[i]->type); + ppace[i]->access_req, + ppace[i]->type); acl_mode &= 0700; if (!owner_found) { @@ -445,7 +445,8 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, ppace[i]->sid.sub_auth[ppace[i]->sid.num_subauth - 1] == DOMAIN_USER_RID_LE) { acl_mode = access_flags_to_mode(fattr, - ppace[i]->access_req, ppace[i]->type); + ppace[i]->access_req, + ppace[i]->type); acl_mode &= 0070; if (!group_found) { mode &= ~(0070); @@ -454,7 +455,8 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, group_found = true; } else if (!compare_sids(&ppace[i]->sid, &sid_everyone)) { acl_mode = access_flags_to_mode(fattr, - ppace[i]->access_req, ppace[i]->type); + ppace[i]->access_req, + ppace[i]->type); acl_mode &= 0007; if (!others_found) { mode &= ~(0007); @@ -471,12 +473,12 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, struct smb_fattr temp_fattr; acl_mode = access_flags_to_mode(fattr, ppace[i]->access_req, - ppace[i]->type); + ppace[i]->type); temp_fattr.cf_uid = INVALID_UID; ret = sid_to_id(&ppace[i]->sid, SIDOWNER, &temp_fattr); if (ret || uid_eq(temp_fattr.cf_uid, INVALID_UID)) { ksmbd_err("%s: Error %d mapping Owner SID to uid\n", - __func__, ret); + __func__, ret); continue; } @@ -553,7 +555,8 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl, } static void set_posix_acl_entries_dacl(struct smb_ace *pndace, - struct smb_fattr *fattr, u32 *num_aces, u16 *size, u32 nt_aces_num) + struct smb_fattr *fattr, u32 *num_aces, + u16 *size, u32 nt_aces_num) { struct posix_acl_entry *pace; struct smb_sid *sid; @@ -665,8 +668,9 @@ posix_default_acl: } static void set_ntacl_dacl(struct smb_acl *pndacl, struct smb_acl *nt_dacl, - const struct smb_sid *pownersid, const struct smb_sid *pgrpsid, - struct smb_fattr *fattr) + const struct smb_sid *pownersid, + const struct smb_sid *pgrpsid, + struct smb_fattr *fattr) { struct smb_ace *ntace, *pndace; int nt_num_aces = le32_to_cpu(nt_dacl->num_aces), num_aces = 0; @@ -711,7 +715,7 @@ static void set_mode_dacl(struct smb_acl *pndacl, struct smb_fattr *fattr) else sid = &sid_unix_users; ace_size = fill_ace_for_sid(pace, sid, ACCESS_ALLOWED, 0, - fattr->cf_mode, 0700); + fattr->cf_mode, 0700); pace->sid.sub_auth[pace->sid.num_subauth++] = cpu_to_le32(uid); pace->access_req |= FILE_DELETE_LE | FILE_DELETE_CHILD_LE; pace->size = cpu_to_le16(ace_size + 4); @@ -720,7 +724,7 @@ static void set_mode_dacl(struct smb_acl *pndacl, struct smb_fattr *fattr) /* Group RID */ ace_size = fill_ace_for_sid(pace, &sid_unix_groups, - ACCESS_ALLOWED, 0, fattr->cf_mode, 0070); + ACCESS_ALLOWED, 0, fattr->cf_mode, 0070); pace->sid.sub_auth[pace->sid.num_subauth++] = cpu_to_le32(from_kgid(&init_user_ns, fattr->cf_gid)); pace->size = cpu_to_le16(ace_size + 4); @@ -733,20 +737,20 @@ static void set_mode_dacl(struct smb_acl *pndacl, struct smb_fattr *fattr) /* creator owner */ size += fill_ace_for_sid(pace, &creator_owner, ACCESS_ALLOWED, - 0x0b, fattr->cf_mode, 0700); + 0x0b, fattr->cf_mode, 0700); pace->access_req |= FILE_DELETE_LE | FILE_DELETE_CHILD_LE; pace = (struct smb_ace *)((char *)pndace + size); /* creator group */ size += fill_ace_for_sid(pace, &creator_group, ACCESS_ALLOWED, - 0x0b, fattr->cf_mode, 0070); + 0x0b, fattr->cf_mode, 0070); pace = (struct smb_ace *)((char *)pndace + size); num_aces = 5; } /* other */ size += fill_ace_for_sid(pace, &sid_everyone, ACCESS_ALLOWED, 0, - fattr->cf_mode, 0007); + fattr->cf_mode, 0007); out: pndacl->num_aces = cpu_to_le32(num_aces); @@ -769,7 +773,7 @@ static int parse_sid(struct smb_sid *psid, char *end_of_acl) /* Convert CIFS ACL to POSIX form */ int parse_sec_desc(struct smb_ntsd *pntsd, int acl_len, - struct smb_fattr *fattr) + struct smb_fattr *fattr) { int rc = 0; struct smb_sid *owner_sid_ptr, *group_sid_ptr; @@ -788,10 +792,10 @@ int parse_sec_desc(struct smb_ntsd *pntsd, int acl_len, dacloffset = le32_to_cpu(pntsd->dacloffset); dacl_ptr = (struct smb_acl *)((char *)pntsd + dacloffset); ksmbd_debug(SMB, - "revision %d type 0x%x ooffset 0x%x goffset 0x%x sacloffset 0x%x dacloffset 0x%x\n", - pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), - le32_to_cpu(pntsd->gsidoffset), - le32_to_cpu(pntsd->sacloffset), dacloffset); + "revision %d type 0x%x ooffset 0x%x goffset 0x%x sacloffset 0x%x dacloffset 0x%x\n", + pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), + le32_to_cpu(pntsd->gsidoffset), + le32_to_cpu(pntsd->sacloffset), dacloffset); pntsd_type = le16_to_cpu(pntsd->type); if (!(pntsd_type & DACL_PRESENT)) { @@ -811,7 +815,7 @@ int parse_sec_desc(struct smb_ntsd *pntsd, int acl_len, rc = sid_to_id(owner_sid_ptr, SIDOWNER, fattr); if (rc) { ksmbd_err("%s: Error %d mapping Owner SID to uid\n", - __func__, rc); + __func__, rc); owner_sid_ptr = NULL; } } @@ -820,19 +824,18 @@ int parse_sec_desc(struct smb_ntsd *pntsd, int acl_len, rc = parse_sid(group_sid_ptr, end_of_acl); if (rc) { ksmbd_err("%s: Error %d mapping Owner SID to gid\n", - __func__, rc); + __func__, rc); return rc; } rc = sid_to_id(group_sid_ptr, SIDUNIX_GROUP, fattr); if (rc) { ksmbd_err("%s: Error %d mapping Group SID to gid\n", - __func__, rc); + __func__, rc); group_sid_ptr = NULL; } } - if ((pntsd_type & - (DACL_AUTO_INHERITED | DACL_AUTO_INHERIT_REQ)) == + if ((pntsd_type & (DACL_AUTO_INHERITED | DACL_AUTO_INHERIT_REQ)) == (DACL_AUTO_INHERITED | DACL_AUTO_INHERIT_REQ)) pntsd->type |= cpu_to_le16(DACL_AUTO_INHERITED); if (pntsd_type & DACL_PROTECTED) @@ -840,7 +843,7 @@ int parse_sec_desc(struct smb_ntsd *pntsd, int acl_len, if (dacloffset) { parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, group_sid_ptr, - fattr); + fattr); } return 0; @@ -848,7 +851,8 @@ int parse_sec_desc(struct smb_ntsd *pntsd, int acl_len, /* Convert permission bits from mode to equivalent CIFS ACL */ int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *ppntsd, - int addition_info, __u32 *secdesclen, struct smb_fattr *fattr) + int addition_info, __u32 *secdesclen, + struct smb_fattr *fattr) { int rc = 0; __u32 offset; @@ -929,7 +933,7 @@ out: } static void smb_set_ace(struct smb_ace *ace, const struct smb_sid *sid, u8 type, - u8 flags, __le32 access_req) + u8 flags, __le32 access_req) { ace->type = type; ace->flags = flags; @@ -939,7 +943,7 @@ static void smb_set_ace(struct smb_ace *ace, const struct smb_sid *sid, u8 type, } int smb_inherit_dacl(struct ksmbd_conn *conn, struct dentry *dentry, - unsigned int uid, unsigned int gid) + unsigned int uid, unsigned int gid) { const struct smb_sid *psid, *creator = NULL; struct smb_ace *parent_aces, *aces; @@ -1003,7 +1007,7 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, struct dentry *dentry, if (is_dir && creator && flags & CONTAINER_INHERIT_ACE) { smb_set_ace(aces, psid, parent_aces->type, inherited_flags, - parent_aces->access_req); + parent_aces->access_req); nt_size += le16_to_cpu(aces->size); ace_cnt++; aces = (struct smb_ace *)((char *)aces + le16_to_cpu(aces->size)); @@ -1014,7 +1018,7 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, struct dentry *dentry, } smb_set_ace(aces, psid, parent_aces->type, flags | inherited_flags, - parent_aces->access_req); + parent_aces->access_req); nt_size += le16_to_cpu(aces->size); aces = (struct smb_ace *)((char *)aces + le16_to_cpu(aces->size)); ace_cnt++; @@ -1107,7 +1111,7 @@ bool smb_inherit_flags(int flags, bool is_dir) } int smb_check_perm_dacl(struct ksmbd_conn *conn, struct dentry *dentry, - __le32 *pdaccess, int uid) + __le32 *pdaccess, int uid) { struct smb_ntsd *pntsd = NULL; struct smb_acl *pdacl; @@ -1243,10 +1247,10 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, struct dentry *dentry, } check_access_bits: - if (granted & ~(access_bits | FILE_READ_ATTRIBUTES | - READ_CONTROL | WRITE_DAC | DELETE)) { + if (granted & + ~(access_bits | FILE_READ_ATTRIBUTES | READ_CONTROL | WRITE_DAC | DELETE)) { ksmbd_debug(SMB, "Access denied with winACL, granted : %x, access_req : %x\n", - granted, le32_to_cpu(ace->access_req)); + granted, le32_to_cpu(ace->access_req)); rc = -EACCES; goto err_out; } @@ -1258,8 +1262,8 @@ err_out: } int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon, - struct dentry *dentry, struct smb_ntsd *pntsd, int ntsd_len, - bool type_check) + struct dentry *dentry, struct smb_ntsd *pntsd, int ntsd_len, + bool type_check) { int rc; struct smb_fattr fattr = {{0}}; @@ -1284,10 +1288,10 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon, /* Update posix acls */ if (fattr.cf_dacls) { rc = ksmbd_vfs_set_posix_acl(inode, ACL_TYPE_ACCESS, - fattr.cf_acls); + fattr.cf_acls); if (S_ISDIR(inode->i_mode) && fattr.cf_dacls) rc = ksmbd_vfs_set_posix_acl(inode, ACL_TYPE_DEFAULT, - fattr.cf_dacls); + fattr.cf_dacls); } /* Check it only calling from SD BUFFER context */ |