[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210219083214.11583-1-chakravarthikulkarni2021@gmail.com>
Date: Fri, 19 Feb 2021 14:02:12 +0530
From: chakravarthikulkarni <chakravarthikulkarni2021@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: chakravarthikulkarni2021@...il.com,
David Woodhouse <dwmw2@...radead.org>,
Richard Weinberger <richard@....at>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] fs:jffs2: Fixed return statement in if and else statement
Error: Fixed Error found by checkpath.pl script.
switch and case should be at the same indent
Warning: Fixed Warning found by checkpath.pl script.
Signed-off-by: chakravarthikulkarni <chakravarthikulkarni2021@...il.com>
---
fs/jffs2/acl.c | 105 ++++++++++++++++++++++++-------------------------
1 file changed, 52 insertions(+), 53 deletions(-)
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 093ffbd82395..e66a1c4eaefd 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -38,18 +38,20 @@ static size_t jffs2_acl_size(int count)
static int jffs2_acl_count(size_t size)
{
size_t s;
+ int ret = 0;
size -= sizeof(struct jffs2_acl_header);
if (size < 4 * sizeof(struct jffs2_acl_entry_short)) {
if (size % sizeof(struct jffs2_acl_entry_short))
return -1;
- return size / sizeof(struct jffs2_acl_entry_short);
+ ret = size / sizeof(struct jffs2_acl_entry_short);
} else {
s = size - 4 * sizeof(struct jffs2_acl_entry_short);
if (s % sizeof(struct jffs2_acl_entry))
return -1;
- return s / sizeof(struct jffs2_acl_entry) + 4;
+ ret = s / sizeof(struct jffs2_acl_entry) + 4;
}
+ return ret;
}
static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)
@@ -82,39 +84,37 @@ static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)
if (!acl)
return ERR_PTR(-ENOMEM);
- for (i=0; i < count; i++) {
+ for (i = 0; i < count; i++) {
entry = value;
if (value + sizeof(struct jffs2_acl_entry_short) > end)
goto fail;
acl->a_entries[i].e_tag = je16_to_cpu(entry->e_tag);
acl->a_entries[i].e_perm = je16_to_cpu(entry->e_perm);
switch (acl->a_entries[i].e_tag) {
- case ACL_USER_OBJ:
- case ACL_GROUP_OBJ:
- case ACL_MASK:
- case ACL_OTHER:
- value += sizeof(struct jffs2_acl_entry_short);
- break;
-
- case ACL_USER:
- value += sizeof(struct jffs2_acl_entry);
- if (value > end)
- goto fail;
- acl->a_entries[i].e_uid =
- make_kuid(&init_user_ns,
- je32_to_cpu(entry->e_id));
- break;
- case ACL_GROUP:
- value += sizeof(struct jffs2_acl_entry);
- if (value > end)
- goto fail;
- acl->a_entries[i].e_gid =
- make_kgid(&init_user_ns,
- je32_to_cpu(entry->e_id));
+ case ACL_USER_OBJ:
+ case ACL_GROUP_OBJ:
+ case ACL_MASK:
+ case ACL_OTHER:
+ value += sizeof(struct jffs2_acl_entry_short);
+ break;
+ case ACL_USER:
+ value += sizeof(struct jffs2_acl_entry);
+ if (value > end)
+ goto fail;
+ acl->a_entries[i].e_uid =
+ make_kuid(&init_user_ns,
+ je32_to_cpu(entry->e_id));
break;
-
- default:
+ case ACL_GROUP:
+ value += sizeof(struct jffs2_acl_entry);
+ if (value > end)
goto fail;
+ acl->a_entries[i].e_gid =
+ make_kgid(&init_user_ns,
+ je32_to_cpu(entry->e_id));
+ break;
+ default:
+ goto fail;
}
}
if (value != end)
@@ -139,32 +139,31 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
return ERR_PTR(-ENOMEM);
header->a_version = cpu_to_je32(JFFS2_ACL_VERSION);
e = header + 1;
- for (i=0; i < acl->a_count; i++) {
+ for (i = 0; i < acl->a_count; i++) {
const struct posix_acl_entry *acl_e = &acl->a_entries[i];
+
entry = e;
entry->e_tag = cpu_to_je16(acl_e->e_tag);
entry->e_perm = cpu_to_je16(acl_e->e_perm);
- switch(acl_e->e_tag) {
- case ACL_USER:
- entry->e_id = cpu_to_je32(
- from_kuid(&init_user_ns, acl_e->e_uid));
- e += sizeof(struct jffs2_acl_entry);
- break;
- case ACL_GROUP:
- entry->e_id = cpu_to_je32(
- from_kgid(&init_user_ns, acl_e->e_gid));
- e += sizeof(struct jffs2_acl_entry);
- break;
-
- case ACL_USER_OBJ:
- case ACL_GROUP_OBJ:
- case ACL_MASK:
- case ACL_OTHER:
- e += sizeof(struct jffs2_acl_entry_short);
- break;
-
- default:
- goto fail;
+ switch (acl_e->e_tag) {
+ case ACL_USER:
+ entry->e_id = cpu_to_je32(from_kuid(&init_user_ns,
+ acl_e->e_uid));
+ e += sizeof(struct jffs2_acl_entry);
+ break;
+ case ACL_GROUP:
+ entry->e_id = cpu_to_je32(
+ from_kgid(&init_user_ns, acl_e->e_gid));
+ e += sizeof(struct jffs2_acl_entry);
+ break;
+ case ACL_USER_OBJ:
+ case ACL_GROUP_OBJ:
+ case ACL_MASK:
+ case ACL_OTHER:
+ e += sizeof(struct jffs2_acl_entry_short);
+ break;
+ default:
+ goto fail;
}
}
return header;
@@ -196,13 +195,13 @@ struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
return ERR_PTR(-ENOMEM);
rc = do_jffs2_getxattr(inode, xprefix, "", value, rc);
}
- if (rc > 0) {
+ if (rc > 0)
acl = jffs2_acl_from_medium(value, rc);
- } else if (rc == -ENODATA || rc == -ENOSYS) {
+ else if (rc == -ENODATA || rc == -ENOSYS)
acl = NULL;
- } else {
+ else
acl = ERR_PTR(rc);
- }
+
kfree(value);
return acl;
}
--
2.17.1
Powered by blists - more mailing lists