summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2018-06-14 18:27:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-14 18:55:25 -0400
commit0825a6f98689d847ab8058c51b3a55f0abcc6563 (patch)
treeafafc007e847815270038de2cf5a23772941d205
parent14f28f5776927be30717986f86b765d49eec392c (diff)
mm: use octal not symbolic permissions
mm/*.c files use symbolic and octal styles for permissions. Using octal and not symbolic permissions is preferred by many as more readable. https://lkml.org/lkml/2016/8/2/1945 Prefer the direct use of octal for permissions. Done using $ scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace mm/*.c and some typing. Before: $ git grep -P -w "0[0-7]{3,3}" mm | wc -l 44 After: $ git grep -P -w "0[0-7]{3,3}" mm | wc -l 86 Miscellanea: o Whitespace neatening around these conversions. Link: http://lkml.kernel.org/r/2e032ef111eebcd4c5952bae86763b541d373469.1522102887.git.joe@perches.com Signed-off-by: Joe Perches <joe@perches.com> Acked-by: David Rientjes <rientjes@google.com> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/cleancache.c10
-rw-r--r--mm/cma_debug.c25
-rw-r--r--mm/compaction.c2
-rw-r--r--mm/dmapool.c2
-rw-r--r--mm/failslab.c2
-rw-r--r--mm/frontswap.c11
-rw-r--r--mm/memblock.c9
-rw-r--r--mm/page_alloc.c2
-rw-r--r--mm/page_idle.c2
-rw-r--r--mm/page_owner.c4
-rw-r--r--mm/shmem.c9
-rw-r--r--mm/slab_common.c4
-rw-r--r--mm/vmalloc.c4
-rw-r--r--mm/zsmalloc.c5
-rw-r--r--mm/zswap.c38
15 files changed, 63 insertions, 66 deletions
diff --git a/mm/cleancache.c b/mm/cleancache.c
index 126548b5a292..2bf12da9baa0 100644
--- a/mm/cleancache.c
+++ b/mm/cleancache.c
@@ -307,12 +307,10 @@ static int __init init_cleancache(void)
307 struct dentry *root = debugfs_create_dir("cleancache", NULL); 307 struct dentry *root = debugfs_create_dir("cleancache", NULL);
308 if (root == NULL) 308 if (root == NULL)
309 return -ENXIO; 309 return -ENXIO;
310 debugfs_create_u64("succ_gets", S_IRUGO, root, &cleancache_succ_gets); 310 debugfs_create_u64("succ_gets", 0444, root, &cleancache_succ_gets);
311 debugfs_create_u64("failed_gets", S_IRUGO, 311 debugfs_create_u64("failed_gets", 0444, root, &cleancache_failed_gets);
312 root, &cleancache_failed_gets); 312 debugfs_create_u64("puts", 0444, root, &cleancache_puts);
313 debugfs_create_u64("puts", S_IRUGO, root, &cleancache_puts); 313 debugfs_create_u64("invalidates", 0444, root, &cleancache_invalidates);
314 debugfs_create_u64("invalidates", S_IRUGO,
315 root, &cleancache_invalidates);
316#endif 314#endif
317 return 0; 315 return 0;
318} 316}
diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index 275df8b5b22e..f23467291cfb 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -172,23 +172,18 @@ static void cma_debugfs_add_one(struct cma *cma, int idx)
172 172
173 tmp = debugfs_create_dir(name, cma_debugfs_root); 173 tmp = debugfs_create_dir(name, cma_debugfs_root);
174 174
175 debugfs_create_file("alloc", S_IWUSR, tmp, cma, 175 debugfs_create_file("alloc", 0200, tmp, cma, &cma_alloc_fops);
176 &cma_alloc_fops); 176 debugfs_create_file("free", 0200, tmp, cma, &cma_free_fops);
177 177 debugfs_create_file("base_pfn", 0444, tmp,
178 debugfs_create_file("free", S_IWUSR, tmp, cma, 178 &cma->base_pfn, &cma_debugfs_fops);
179 &cma_free_fops); 179 debugfs_create_file("count", 0444, tmp, &cma->count, &cma_debugfs_fops);
180 180 debugfs_create_file("order_per_bit", 0444, tmp,
181 debugfs_create_file("base_pfn", S_IRUGO, tmp, 181 &cma->order_per_bit, &cma_debugfs_fops);
182 &cma->base_pfn, &cma_debugfs_fops); 182 debugfs_create_file("used", 0444, tmp, cma, &cma_used_fops);
183 debugfs_create_file("count", S_IRUGO, tmp, 183 debugfs_create_file("maxchunk", 0444, tmp, cma, &cma_maxchunk_fops);
184 &cma->count, &cma_debugfs_fops);
185 debugfs_create_file("order_per_bit", S_IRUGO, tmp,
186 &cma->order_per_bit, &cma_debugfs_fops);
187 debugfs_create_file("used", S_IRUGO, tmp, cma, &cma_used_fops);
188 debugfs_create_file("maxchunk", S_IRUGO, tmp, cma, &cma_maxchunk_fops);
189 184
190 u32s = DIV_ROUND_UP(cma_bitmap_maxno(cma), BITS_PER_BYTE * sizeof(u32)); 185 u32s = DIV_ROUND_UP(cma_bitmap_maxno(cma), BITS_PER_BYTE * sizeof(u32));
191 debugfs_create_u32_array("bitmap", S_IRUGO, tmp, (u32*)cma->bitmap, u32s); 186 debugfs_create_u32_array("bitmap", 0444, tmp, (u32 *)cma->bitmap, u32s);
192} 187}
193 188
194static int __init cma_debugfs_init(void) 189static int __init cma_debugfs_init(void)
diff --git a/mm/compaction.c b/mm/compaction.c
index 29bd1df18b98..faca45ebe62d 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1899,7 +1899,7 @@ static ssize_t sysfs_compact_node(struct device *dev,
1899 1899
1900 return count; 1900 return count;
1901} 1901}
1902static DEVICE_ATTR(compact, S_IWUSR, NULL, sysfs_compact_node); 1902static DEVICE_ATTR(compact, 0200, NULL, sysfs_compact_node);
1903 1903
1904int compaction_register_node(struct node *node) 1904int compaction_register_node(struct node *node)
1905{ 1905{
diff --git a/mm/dmapool.c b/mm/dmapool.c
index 4d90a64b2fdc..6d4b97e7e9e9 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -105,7 +105,7 @@ show_pools(struct device *dev, struct device_attribute *attr, char *buf)
105 return PAGE_SIZE - size; 105 return PAGE_SIZE - size;
106} 106}
107 107
108static DEVICE_ATTR(pools, S_IRUGO, show_pools, NULL); 108static DEVICE_ATTR(pools, 0444, show_pools, NULL);
109 109
110/** 110/**
111 * dma_pool_create - Creates a pool of consistent memory blocks, for dma. 111 * dma_pool_create - Creates a pool of consistent memory blocks, for dma.
diff --git a/mm/failslab.c b/mm/failslab.c
index 1f2f248e3601..b135ebb88b6f 100644
--- a/mm/failslab.c
+++ b/mm/failslab.c
@@ -42,7 +42,7 @@ __setup("failslab=", setup_failslab);
42static int __init failslab_debugfs_init(void) 42static int __init failslab_debugfs_init(void)
43{ 43{
44 struct dentry *dir; 44 struct dentry *dir;
45 umode_t mode = S_IFREG | S_IRUSR | S_IWUSR; 45 umode_t mode = S_IFREG | 0600;
46 46
47 dir = fault_create_debugfs_attr("failslab", NULL, &failslab.attr); 47 dir = fault_create_debugfs_attr("failslab", NULL, &failslab.attr);
48 if (IS_ERR(dir)) 48 if (IS_ERR(dir))
diff --git a/mm/frontswap.c b/mm/frontswap.c
index 4f5476a0f955..157e5bf63504 100644
--- a/mm/frontswap.c
+++ b/mm/frontswap.c
@@ -486,12 +486,11 @@ static int __init init_frontswap(void)
486 struct dentry *root = debugfs_create_dir("frontswap", NULL); 486 struct dentry *root = debugfs_create_dir("frontswap", NULL);
487 if (root == NULL) 487 if (root == NULL)
488 return -ENXIO; 488 return -ENXIO;
489 debugfs_create_u64("loads", S_IRUGO, root, &frontswap_loads); 489 debugfs_create_u64("loads", 0444, root, &frontswap_loads);
490 debugfs_create_u64("succ_stores", S_IRUGO, root, &frontswap_succ_stores); 490 debugfs_create_u64("succ_stores", 0444, root, &frontswap_succ_stores);
491 debugfs_create_u64("failed_stores", S_IRUGO, root, 491 debugfs_create_u64("failed_stores", 0444, root,
492 &frontswap_failed_stores); 492 &frontswap_failed_stores);
493 debugfs_create_u64("invalidates", S_IRUGO, 493 debugfs_create_u64("invalidates", 0444, root, &frontswap_invalidates);
494 root, &frontswap_invalidates);
495#endif 494#endif
496 return 0; 495 return 0;
497} 496}
diff --git a/mm/memblock.c b/mm/memblock.c
index f1dba2826d0f..cc16d70b8333 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1809,10 +1809,13 @@ static int __init memblock_init_debugfs(void)
1809 struct dentry *root = debugfs_create_dir("memblock", NULL); 1809 struct dentry *root = debugfs_create_dir("memblock", NULL);
1810 if (!root) 1810 if (!root)
1811 return -ENXIO; 1811 return -ENXIO;
1812 debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops); 1812 debugfs_create_file("memory", 0444, root,
1813 debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops); 1813 &memblock.memory, &memblock_debug_fops);
1814 debugfs_create_file("reserved", 0444, root,
1815 &memblock.reserved, &memblock_debug_fops);
1814#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP 1816#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
1815 debugfs_create_file("physmem", S_IRUGO, root, &memblock.physmem, &memblock_debug_fops); 1817 debugfs_create_file("physmem", 0444, root,
1818 &memblock.physmem, &memblock_debug_fops);
1816#endif 1819#endif
1817 1820
1818 return 0; 1821 return 0;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 07b3c23762ad..1521100f1e63 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3061,7 +3061,7 @@ static bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
3061 3061
3062static int __init fail_page_alloc_debugfs(void) 3062static int __init fail_page_alloc_debugfs(void)
3063{ 3063{
3064 umode_t mode = S_IFREG | S_IRUSR | S_IWUSR; 3064 umode_t mode = S_IFREG | 0600;
3065 struct dentry *dir; 3065 struct dentry *dir;
3066 3066
3067 dir = fault_create_debugfs_attr("fail_page_alloc", NULL, 3067 dir = fault_create_debugfs_attr("fail_page_alloc", NULL,
diff --git a/mm/page_idle.c b/mm/page_idle.c
index e412a63b2b74..6302bc62c27d 100644
--- a/mm/page_idle.c
+++ b/mm/page_idle.c
@@ -201,7 +201,7 @@ static ssize_t page_idle_bitmap_write(struct file *file, struct kobject *kobj,
201} 201}
202 202
203static struct bin_attribute page_idle_bitmap_attr = 203static struct bin_attribute page_idle_bitmap_attr =
204 __BIN_ATTR(bitmap, S_IRUSR | S_IWUSR, 204 __BIN_ATTR(bitmap, 0600,
205 page_idle_bitmap_read, page_idle_bitmap_write, 0); 205 page_idle_bitmap_read, page_idle_bitmap_write, 0);
206 206
207static struct bin_attribute *page_idle_bin_attrs[] = { 207static struct bin_attribute *page_idle_bin_attrs[] = {
diff --git a/mm/page_owner.c b/mm/page_owner.c
index 75d21a2259b3..d80adfe702d3 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -631,8 +631,8 @@ static int __init pageowner_init(void)
631 return 0; 631 return 0;
632 } 632 }
633 633
634 dentry = debugfs_create_file("page_owner", S_IRUSR, NULL, 634 dentry = debugfs_create_file("page_owner", 0400, NULL,
635 NULL, &proc_page_owner_operations); 635 NULL, &proc_page_owner_operations);
636 636
637 return PTR_ERR_OR_ZERO(dentry); 637 return PTR_ERR_OR_ZERO(dentry);
638} 638}
diff --git a/mm/shmem.c b/mm/shmem.c
index e9a7ac74823d..2cab84403055 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3013,7 +3013,8 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
3013 if (len > PAGE_SIZE) 3013 if (len > PAGE_SIZE)
3014 return -ENAMETOOLONG; 3014 return -ENAMETOOLONG;
3015 3015
3016 inode = shmem_get_inode(dir->i_sb, dir, S_IFLNK|S_IRWXUGO, 0, VM_NORESERVE); 3016 inode = shmem_get_inode(dir->i_sb, dir, S_IFLNK | 0777, 0,
3017 VM_NORESERVE);
3017 if (!inode) 3018 if (!inode)
3018 return -ENOSPC; 3019 return -ENOSPC;
3019 3020
@@ -3445,7 +3446,7 @@ static int shmem_show_options(struct seq_file *seq, struct dentry *root)
3445 sbinfo->max_blocks << (PAGE_SHIFT - 10)); 3446 sbinfo->max_blocks << (PAGE_SHIFT - 10));
3446 if (sbinfo->max_inodes != shmem_default_max_inodes()) 3447 if (sbinfo->max_inodes != shmem_default_max_inodes())
3447 seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes); 3448 seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes);
3448 if (sbinfo->mode != (S_IRWXUGO | S_ISVTX)) 3449 if (sbinfo->mode != (0777 | S_ISVTX))
3449 seq_printf(seq, ",mode=%03ho", sbinfo->mode); 3450 seq_printf(seq, ",mode=%03ho", sbinfo->mode);
3450 if (!uid_eq(sbinfo->uid, GLOBAL_ROOT_UID)) 3451 if (!uid_eq(sbinfo->uid, GLOBAL_ROOT_UID))
3451 seq_printf(seq, ",uid=%u", 3452 seq_printf(seq, ",uid=%u",
@@ -3486,7 +3487,7 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
3486 if (!sbinfo) 3487 if (!sbinfo)
3487 return -ENOMEM; 3488 return -ENOMEM;
3488 3489
3489 sbinfo->mode = S_IRWXUGO | S_ISVTX; 3490 sbinfo->mode = 0777 | S_ISVTX;
3490 sbinfo->uid = current_fsuid(); 3491 sbinfo->uid = current_fsuid();
3491 sbinfo->gid = current_fsgid(); 3492 sbinfo->gid = current_fsgid();
3492 sb->s_fs_info = sbinfo; 3493 sb->s_fs_info = sbinfo;
@@ -3929,7 +3930,7 @@ static struct file *__shmem_file_setup(struct vfsmount *mnt, const char *name, l
3929 d_set_d_op(path.dentry, &anon_ops); 3930 d_set_d_op(path.dentry, &anon_ops);
3930 3931
3931 res = ERR_PTR(-ENOSPC); 3932 res = ERR_PTR(-ENOSPC);
3932 inode = shmem_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0, flags); 3933 inode = shmem_get_inode(sb, NULL, S_IFREG | 0777, 0, flags);
3933 if (!inode) 3934 if (!inode)
3934 goto put_memory; 3935 goto put_memory;
3935 3936
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 42aca26d61d0..890b1f04a03a 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -1243,9 +1243,9 @@ void cache_random_seq_destroy(struct kmem_cache *cachep)
1243 1243
1244#if defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG) 1244#if defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG)
1245#ifdef CONFIG_SLAB 1245#ifdef CONFIG_SLAB
1246#define SLABINFO_RIGHTS (S_IWUSR | S_IRUSR) 1246#define SLABINFO_RIGHTS (0600)
1247#else 1247#else
1248#define SLABINFO_RIGHTS S_IRUSR 1248#define SLABINFO_RIGHTS (0400)
1249#endif 1249#endif
1250 1250
1251static void print_slabinfo_header(struct seq_file *m) 1251static void print_slabinfo_header(struct seq_file *m)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 89efac3a020e..cfea25be7754 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2741,11 +2741,11 @@ static const struct seq_operations vmalloc_op = {
2741static int __init proc_vmalloc_init(void) 2741static int __init proc_vmalloc_init(void)
2742{ 2742{
2743 if (IS_ENABLED(CONFIG_NUMA)) 2743 if (IS_ENABLED(CONFIG_NUMA))
2744 proc_create_seq_private("vmallocinfo", S_IRUSR, NULL, 2744 proc_create_seq_private("vmallocinfo", 0400, NULL,
2745 &vmalloc_op, 2745 &vmalloc_op,
2746 nr_node_ids * sizeof(unsigned int), NULL); 2746 nr_node_ids * sizeof(unsigned int), NULL);
2747 else 2747 else
2748 proc_create_seq("vmallocinfo", S_IRUSR, NULL, &vmalloc_op); 2748 proc_create_seq("vmallocinfo", 0400, NULL, &vmalloc_op);
2749 return 0; 2749 return 0;
2750} 2750}
2751module_init(proc_vmalloc_init); 2751module_init(proc_vmalloc_init);
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 61cb05dc950c..8d87e973a4f5 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -661,8 +661,9 @@ static void zs_pool_stat_create(struct zs_pool *pool, const char *name)
661 } 661 }
662 pool->stat_dentry = entry; 662 pool->stat_dentry = entry;
663 663
664 entry = debugfs_create_file("classes", S_IFREG | S_IRUGO, 664 entry = debugfs_create_file("classes", S_IFREG | 0444,
665 pool->stat_dentry, pool, &zs_stats_size_fops); 665 pool->stat_dentry, pool,
666 &zs_stats_size_fops);
666 if (!entry) { 667 if (!entry) {
667 pr_warn("%s: debugfs file entry <%s> creation failed\n", 668 pr_warn("%s: debugfs file entry <%s> creation failed\n",
668 name, "classes"); 669 name, "classes");
diff --git a/mm/zswap.c b/mm/zswap.c
index 61a5c41972db..7d34e69507e3 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1256,26 +1256,26 @@ static int __init zswap_debugfs_init(void)
1256 if (!zswap_debugfs_root) 1256 if (!zswap_debugfs_root)
1257 return -ENOMEM; 1257 return -ENOMEM;
1258 1258
1259 debugfs_create_u64("pool_limit_hit", S_IRUGO, 1259 debugfs_create_u64("pool_limit_hit", 0444,
1260 zswap_debugfs_root, &zswap_pool_limit_hit); 1260 zswap_debugfs_root, &zswap_pool_limit_hit);
1261 debugfs_create_u64("reject_reclaim_fail", S_IRUGO, 1261 debugfs_create_u64("reject_reclaim_fail", 0444,
1262 zswap_debugfs_root, &zswap_reject_reclaim_fail); 1262 zswap_debugfs_root, &zswap_reject_reclaim_fail);
1263 debugfs_create_u64("reject_alloc_fail", S_IRUGO, 1263 debugfs_create_u64("reject_alloc_fail", 0444,
1264 zswap_debugfs_root, &zswap_reject_alloc_fail); 1264 zswap_debugfs_root, &zswap_reject_alloc_fail);
1265 debugfs_create_u64("reject_kmemcache_fail", S_IRUGO, 1265 debugfs_create_u64("reject_kmemcache_fail", 0444,
1266 zswap_debugfs_root, &zswap_reject_kmemcache_fail); 1266 zswap_debugfs_root, &zswap_reject_kmemcache_fail);
1267 debugfs_create_u64("reject_compress_poor", S_IRUGO, 1267 debugfs_create_u64("reject_compress_poor", 0444,
1268 zswap_debugfs_root, &zswap_reject_compress_poor); 1268 zswap_debugfs_root, &zswap_reject_compress_poor);
1269 debugfs_create_u64("written_back_pages", S_IRUGO, 1269 debugfs_create_u64("written_back_pages", 0444,
1270 zswap_debugfs_root, &zswap_written_back_pages); 1270 zswap_debugfs_root, &zswap_written_back_pages);
1271 debugfs_create_u64("duplicate_entry", S_IRUGO, 1271 debugfs_create_u64("duplicate_entry", 0444,
1272 zswap_debugfs_root, &zswap_duplicate_entry); 1272 zswap_debugfs_root, &zswap_duplicate_entry);
1273 debugfs_create_u64("pool_total_size", S_IRUGO, 1273 debugfs_create_u64("pool_total_size", 0444,
1274 zswap_debugfs_root, &zswap_pool_total_size); 1274 zswap_debugfs_root, &zswap_pool_total_size);
1275 debugfs_create_atomic_t("stored_pages", S_IRUGO, 1275 debugfs_create_atomic_t("stored_pages", 0444,
1276 zswap_debugfs_root, &zswap_stored_pages); 1276 zswap_debugfs_root, &zswap_stored_pages);
1277 debugfs_create_atomic_t("same_filled_pages", 0444, 1277 debugfs_create_atomic_t("same_filled_pages", 0444,
1278 zswap_debugfs_root, &zswap_same_filled_pages); 1278 zswap_debugfs_root, &zswap_same_filled_pages);
1279 1279
1280 return 0; 1280 return 0;
1281} 1281}