tomoyo: Coding style fix.
Follow many of recommendations by scripts/checkpatch.pl, and follow "lift switch variables out of switches" by Kees Cook. This patch makes no functional change. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <james.morris@microsoft.com>
This commit is contained in:

committed by
James Morris

parent
8c6cb983cd
commit
cdcf6723ad
@@ -214,6 +214,7 @@ static int tomoyo_audit_path_number_log(struct tomoyo_request_info *r)
|
||||
const u8 type = r->param.path_number.operation;
|
||||
u8 radix;
|
||||
char buffer[64];
|
||||
|
||||
switch (type) {
|
||||
case TOMOYO_TYPE_CREATE:
|
||||
case TOMOYO_TYPE_MKDIR:
|
||||
@@ -253,6 +254,7 @@ static bool tomoyo_check_path_acl(struct tomoyo_request_info *r,
|
||||
{
|
||||
const struct tomoyo_path_acl *acl = container_of(ptr, typeof(*acl),
|
||||
head);
|
||||
|
||||
if (acl->perm & (1 << r->param.path.operation)) {
|
||||
r->param.path.matched_path =
|
||||
tomoyo_compare_name_union(r->param.path.filename,
|
||||
@@ -275,6 +277,7 @@ static bool tomoyo_check_path_number_acl(struct tomoyo_request_info *r,
|
||||
{
|
||||
const struct tomoyo_path_number_acl *acl =
|
||||
container_of(ptr, typeof(*acl), head);
|
||||
|
||||
return (acl->perm & (1 << r->param.path_number.operation)) &&
|
||||
tomoyo_compare_number_union(r->param.path_number.number,
|
||||
&acl->number) &&
|
||||
@@ -295,6 +298,7 @@ static bool tomoyo_check_path2_acl(struct tomoyo_request_info *r,
|
||||
{
|
||||
const struct tomoyo_path2_acl *acl =
|
||||
container_of(ptr, typeof(*acl), head);
|
||||
|
||||
return (acl->perm & (1 << r->param.path2.operation)) &&
|
||||
tomoyo_compare_name_union(r->param.path2.filename1, &acl->name1)
|
||||
&& tomoyo_compare_name_union(r->param.path2.filename2,
|
||||
@@ -314,6 +318,7 @@ static bool tomoyo_check_mkdev_acl(struct tomoyo_request_info *r,
|
||||
{
|
||||
const struct tomoyo_mkdev_acl *acl =
|
||||
container_of(ptr, typeof(*acl), head);
|
||||
|
||||
return (acl->perm & (1 << r->param.mkdev.operation)) &&
|
||||
tomoyo_compare_number_union(r->param.mkdev.mode,
|
||||
&acl->mode) &&
|
||||
@@ -338,6 +343,7 @@ static bool tomoyo_same_path_acl(const struct tomoyo_acl_info *a,
|
||||
{
|
||||
const struct tomoyo_path_acl *p1 = container_of(a, typeof(*p1), head);
|
||||
const struct tomoyo_path_acl *p2 = container_of(b, typeof(*p2), head);
|
||||
|
||||
return tomoyo_same_name_union(&p1->name, &p2->name);
|
||||
}
|
||||
|
||||
@@ -358,6 +364,7 @@ static bool tomoyo_merge_path_acl(struct tomoyo_acl_info *a,
|
||||
->perm;
|
||||
u16 perm = *a_perm;
|
||||
const u16 b_perm = container_of(b, struct tomoyo_path_acl, head)->perm;
|
||||
|
||||
if (is_delete)
|
||||
perm &= ~b_perm;
|
||||
else
|
||||
@@ -384,6 +391,7 @@ static int tomoyo_update_path_acl(const u16 perm,
|
||||
.perm = perm
|
||||
};
|
||||
int error;
|
||||
|
||||
if (!tomoyo_parse_name_union(param, &e.name))
|
||||
error = -EINVAL;
|
||||
else
|
||||
@@ -407,6 +415,7 @@ static bool tomoyo_same_mkdev_acl(const struct tomoyo_acl_info *a,
|
||||
{
|
||||
const struct tomoyo_mkdev_acl *p1 = container_of(a, typeof(*p1), head);
|
||||
const struct tomoyo_mkdev_acl *p2 = container_of(b, typeof(*p2), head);
|
||||
|
||||
return tomoyo_same_name_union(&p1->name, &p2->name) &&
|
||||
tomoyo_same_number_union(&p1->mode, &p2->mode) &&
|
||||
tomoyo_same_number_union(&p1->major, &p2->major) &&
|
||||
@@ -431,6 +440,7 @@ static bool tomoyo_merge_mkdev_acl(struct tomoyo_acl_info *a,
|
||||
u8 perm = *a_perm;
|
||||
const u8 b_perm = container_of(b, struct tomoyo_mkdev_acl, head)
|
||||
->perm;
|
||||
|
||||
if (is_delete)
|
||||
perm &= ~b_perm;
|
||||
else
|
||||
@@ -457,6 +467,7 @@ static int tomoyo_update_mkdev_acl(const u8 perm,
|
||||
.perm = perm
|
||||
};
|
||||
int error;
|
||||
|
||||
if (!tomoyo_parse_name_union(param, &e.name) ||
|
||||
!tomoyo_parse_number_union(param, &e.mode) ||
|
||||
!tomoyo_parse_number_union(param, &e.major) ||
|
||||
@@ -486,6 +497,7 @@ static bool tomoyo_same_path2_acl(const struct tomoyo_acl_info *a,
|
||||
{
|
||||
const struct tomoyo_path2_acl *p1 = container_of(a, typeof(*p1), head);
|
||||
const struct tomoyo_path2_acl *p2 = container_of(b, typeof(*p2), head);
|
||||
|
||||
return tomoyo_same_name_union(&p1->name1, &p2->name1) &&
|
||||
tomoyo_same_name_union(&p1->name2, &p2->name2);
|
||||
}
|
||||
@@ -507,6 +519,7 @@ static bool tomoyo_merge_path2_acl(struct tomoyo_acl_info *a,
|
||||
->perm;
|
||||
u8 perm = *a_perm;
|
||||
const u8 b_perm = container_of(b, struct tomoyo_path2_acl, head)->perm;
|
||||
|
||||
if (is_delete)
|
||||
perm &= ~b_perm;
|
||||
else
|
||||
@@ -533,6 +546,7 @@ static int tomoyo_update_path2_acl(const u8 perm,
|
||||
.perm = perm
|
||||
};
|
||||
int error;
|
||||
|
||||
if (!tomoyo_parse_name_union(param, &e.name1) ||
|
||||
!tomoyo_parse_name_union(param, &e.name2))
|
||||
error = -EINVAL;
|
||||
@@ -621,6 +635,7 @@ static bool tomoyo_same_path_number_acl(const struct tomoyo_acl_info *a,
|
||||
head);
|
||||
const struct tomoyo_path_number_acl *p2 = container_of(b, typeof(*p2),
|
||||
head);
|
||||
|
||||
return tomoyo_same_name_union(&p1->name, &p2->name) &&
|
||||
tomoyo_same_number_union(&p1->number, &p2->number);
|
||||
}
|
||||
@@ -643,6 +658,7 @@ static bool tomoyo_merge_path_number_acl(struct tomoyo_acl_info *a,
|
||||
u8 perm = *a_perm;
|
||||
const u8 b_perm = container_of(b, struct tomoyo_path_number_acl, head)
|
||||
->perm;
|
||||
|
||||
if (is_delete)
|
||||
perm &= ~b_perm;
|
||||
else
|
||||
@@ -667,6 +683,7 @@ static int tomoyo_update_path_number_acl(const u8 perm,
|
||||
.perm = perm
|
||||
};
|
||||
int error;
|
||||
|
||||
if (!tomoyo_parse_name_union(param, &e.name) ||
|
||||
!tomoyo_parse_number_union(param, &e.number))
|
||||
error = -EINVAL;
|
||||
@@ -947,6 +964,7 @@ static bool tomoyo_same_mount_acl(const struct tomoyo_acl_info *a,
|
||||
{
|
||||
const struct tomoyo_mount_acl *p1 = container_of(a, typeof(*p1), head);
|
||||
const struct tomoyo_mount_acl *p2 = container_of(b, typeof(*p2), head);
|
||||
|
||||
return tomoyo_same_name_union(&p1->dev_name, &p2->dev_name) &&
|
||||
tomoyo_same_name_union(&p1->dir_name, &p2->dir_name) &&
|
||||
tomoyo_same_name_union(&p1->fs_type, &p2->fs_type) &&
|
||||
@@ -966,6 +984,7 @@ static int tomoyo_update_mount_acl(struct tomoyo_acl_param *param)
|
||||
{
|
||||
struct tomoyo_mount_acl e = { .head.type = TOMOYO_TYPE_MOUNT_ACL };
|
||||
int error;
|
||||
|
||||
if (!tomoyo_parse_name_union(param, &e.dev_name) ||
|
||||
!tomoyo_parse_name_union(param, &e.dir_name) ||
|
||||
!tomoyo_parse_name_union(param, &e.fs_type) ||
|
||||
@@ -995,6 +1014,7 @@ int tomoyo_write_file(struct tomoyo_acl_param *param)
|
||||
u16 perm = 0;
|
||||
u8 type;
|
||||
const char *operation = tomoyo_read_token(param);
|
||||
|
||||
for (type = 0; type < TOMOYO_MAX_PATH_OPERATION; type++)
|
||||
if (tomoyo_permstr(operation, tomoyo_path_keyword[type]))
|
||||
perm |= 1 << type;
|
||||
|
Reference in New Issue
Block a user