Skip to content

Commit 97842c5

Browse files
cgzonespcmoore
authored andcommitted
selinux: avoid implicit conversions in selinuxfs code
Use umode_t as parameter type for sel_make_inode(), which assigns the value to the member i_mode of struct inode. Use identical and unsigned types for loop iterators. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent aa4b605 commit 97842c5

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

security/selinux/selinuxfs.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static int selinux_fs_info_create(struct super_block *sb)
9797
static void selinux_fs_info_free(struct super_block *sb)
9898
{
9999
struct selinux_fs_info *fsi = sb->s_fs_info;
100-
int i;
100+
unsigned int i;
101101

102102
if (fsi) {
103103
for (i = 0; i < fsi->bool_num; i++)
@@ -1075,8 +1075,8 @@ static ssize_t sel_write_user(struct file *file, char *buf, size_t size)
10751075
u32 sid, *sids = NULL;
10761076
ssize_t length;
10771077
char *newcon;
1078-
int i, rc;
1079-
u32 len, nsids;
1078+
int rc;
1079+
u32 i, len, nsids;
10801080

10811081
length = avc_has_perm(current_sid(), SECINITSID_SECURITY,
10821082
SECCLASS_SECURITY, SECURITY__COMPUTE_USER,
@@ -1192,7 +1192,7 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size)
11921192
return length;
11931193
}
11941194

1195-
static struct inode *sel_make_inode(struct super_block *sb, int mode)
1195+
static struct inode *sel_make_inode(struct super_block *sb, umode_t mode)
11961196
{
11971197
struct inode *ret = new_inode(sb);
11981198

@@ -1613,7 +1613,7 @@ static int sel_make_avc_files(struct dentry *dir)
16131613
{
16141614
struct super_block *sb = dir->d_sb;
16151615
struct selinux_fs_info *fsi = sb->s_fs_info;
1616-
int i;
1616+
unsigned int i;
16171617
static const struct tree_descr files[] = {
16181618
{ "cache_threshold",
16191619
&sel_avc_cache_threshold_ops, S_IRUGO|S_IWUSR },
@@ -1649,7 +1649,7 @@ static int sel_make_ss_files(struct dentry *dir)
16491649
{
16501650
struct super_block *sb = dir->d_sb;
16511651
struct selinux_fs_info *fsi = sb->s_fs_info;
1652-
int i;
1652+
unsigned int i;
16531653
static const struct tree_descr files[] = {
16541654
{ "sidtab_hash_stats", &sel_sidtab_hash_stats_ops, S_IRUGO },
16551655
};
@@ -1700,7 +1700,7 @@ static const struct file_operations sel_initcon_ops = {
17001700

17011701
static int sel_make_initcon_files(struct dentry *dir)
17021702
{
1703-
int i;
1703+
unsigned int i;
17041704

17051705
for (i = 1; i <= SECINITSID_NUM; i++) {
17061706
struct inode *inode;

0 commit comments

Comments
 (0)