Security: Fix coding style in security/
Fix coding style in security/ Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com> Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:

committed by
James Morris

parent
e2902eb79f
commit
c1a7368a6f
@@ -503,11 +503,11 @@ static ssize_t sel_write_access(struct file *file, char *buf, size_t size)
|
||||
return length;
|
||||
|
||||
length = -ENOMEM;
|
||||
scon = kzalloc(size+1, GFP_KERNEL);
|
||||
scon = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!scon)
|
||||
return length;
|
||||
|
||||
tcon = kzalloc(size+1, GFP_KERNEL);
|
||||
tcon = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!tcon)
|
||||
goto out;
|
||||
|
||||
@@ -515,10 +515,10 @@ static ssize_t sel_write_access(struct file *file, char *buf, size_t size)
|
||||
if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3)
|
||||
goto out2;
|
||||
|
||||
length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
|
||||
length = security_context_to_sid(scon, strlen(scon) + 1, &ssid);
|
||||
if (length < 0)
|
||||
goto out2;
|
||||
length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
|
||||
length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid);
|
||||
if (length < 0)
|
||||
goto out2;
|
||||
|
||||
@@ -550,11 +550,11 @@ static ssize_t sel_write_create(struct file *file, char *buf, size_t size)
|
||||
return length;
|
||||
|
||||
length = -ENOMEM;
|
||||
scon = kzalloc(size+1, GFP_KERNEL);
|
||||
scon = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!scon)
|
||||
return length;
|
||||
|
||||
tcon = kzalloc(size+1, GFP_KERNEL);
|
||||
tcon = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!tcon)
|
||||
goto out;
|
||||
|
||||
@@ -562,10 +562,10 @@ static ssize_t sel_write_create(struct file *file, char *buf, size_t size)
|
||||
if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3)
|
||||
goto out2;
|
||||
|
||||
length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
|
||||
length = security_context_to_sid(scon, strlen(scon) + 1, &ssid);
|
||||
if (length < 0)
|
||||
goto out2;
|
||||
length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
|
||||
length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid);
|
||||
if (length < 0)
|
||||
goto out2;
|
||||
|
||||
@@ -609,11 +609,11 @@ static ssize_t sel_write_relabel(struct file *file, char *buf, size_t size)
|
||||
return length;
|
||||
|
||||
length = -ENOMEM;
|
||||
scon = kzalloc(size+1, GFP_KERNEL);
|
||||
scon = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!scon)
|
||||
return length;
|
||||
|
||||
tcon = kzalloc(size+1, GFP_KERNEL);
|
||||
tcon = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!tcon)
|
||||
goto out;
|
||||
|
||||
@@ -621,10 +621,10 @@ static ssize_t sel_write_relabel(struct file *file, char *buf, size_t size)
|
||||
if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3)
|
||||
goto out2;
|
||||
|
||||
length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
|
||||
length = security_context_to_sid(scon, strlen(scon) + 1, &ssid);
|
||||
if (length < 0)
|
||||
goto out2;
|
||||
length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
|
||||
length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid);
|
||||
if (length < 0)
|
||||
goto out2;
|
||||
|
||||
@@ -666,11 +666,11 @@ static ssize_t sel_write_user(struct file *file, char *buf, size_t size)
|
||||
return length;
|
||||
|
||||
length = -ENOMEM;
|
||||
con = kzalloc(size+1, GFP_KERNEL);
|
||||
con = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!con)
|
||||
return length;
|
||||
|
||||
user = kzalloc(size+1, GFP_KERNEL);
|
||||
user = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!user)
|
||||
goto out;
|
||||
|
||||
@@ -678,7 +678,7 @@ static ssize_t sel_write_user(struct file *file, char *buf, size_t size)
|
||||
if (sscanf(buf, "%s %s", con, user) != 2)
|
||||
goto out2;
|
||||
|
||||
length = security_context_to_sid(con, strlen(con)+1, &sid);
|
||||
length = security_context_to_sid(con, strlen(con) + 1, &sid);
|
||||
if (length < 0)
|
||||
goto out2;
|
||||
|
||||
@@ -727,11 +727,11 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size)
|
||||
return length;
|
||||
|
||||
length = -ENOMEM;
|
||||
scon = kzalloc(size+1, GFP_KERNEL);
|
||||
scon = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!scon)
|
||||
return length;
|
||||
|
||||
tcon = kzalloc(size+1, GFP_KERNEL);
|
||||
tcon = kzalloc(size + 1, GFP_KERNEL);
|
||||
if (!tcon)
|
||||
goto out;
|
||||
|
||||
@@ -739,10 +739,10 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size)
|
||||
if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3)
|
||||
goto out2;
|
||||
|
||||
length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
|
||||
length = security_context_to_sid(scon, strlen(scon) + 1, &ssid);
|
||||
if (length < 0)
|
||||
goto out2;
|
||||
length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
|
||||
length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid);
|
||||
if (length < 0)
|
||||
goto out2;
|
||||
|
||||
@@ -1401,7 +1401,7 @@ static int sel_make_perm_files(char *objclass, int classvalue,
|
||||
}
|
||||
inode->i_fop = &sel_perm_ops;
|
||||
/* i+1 since perm values are 1-indexed */
|
||||
inode->i_ino = sel_perm_to_ino(classvalue, i+1);
|
||||
inode->i_ino = sel_perm_to_ino(classvalue, i + 1);
|
||||
d_add(dentry, inode);
|
||||
}
|
||||
|
||||
@@ -1489,7 +1489,7 @@ static int sel_make_classes(void)
|
||||
goto out;
|
||||
|
||||
/* +2 since classes are 1-indexed */
|
||||
last_class_ino = sel_class_to_ino(nclasses+2);
|
||||
last_class_ino = sel_class_to_ino(nclasses + 2);
|
||||
|
||||
for (i = 0; i < nclasses; i++) {
|
||||
struct dentry *class_name_dir;
|
||||
@@ -1506,7 +1506,7 @@ static int sel_make_classes(void)
|
||||
goto out1;
|
||||
|
||||
/* i+1 since class values are 1-indexed */
|
||||
rc = sel_make_class_dir_entries(classes[i], i+1,
|
||||
rc = sel_make_class_dir_entries(classes[i], i + 1,
|
||||
class_name_dir);
|
||||
if (rc)
|
||||
goto out1;
|
||||
|
Reference in New Issue
Block a user