aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2013-02-27 20:03:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:11 -0500
commit87ebdc00eeb474615496d5f10eed46709e25c707 (patch)
tree614bdfd3620e8e9692bc2d04e718b250081f8d7b /fs/proc
parente579d2c259be42b6f29458327e5153b22414b031 (diff)
fs/proc: clean up printks
- use pr_foo() throughout - remove a couple of duplicated KERN_WARNINGs, via WARN(KERN_WARNING "...") - nuke a few warnings which I've never seen happen, ever. Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/base.c3
-rw-r--r--fs/proc/generic.c27
-rw-r--r--fs/proc/inode.c5
-rw-r--r--fs/proc/kcore.c3
-rw-r--r--fs/proc/proc_devtree.c13
-rw-r--r--fs/proc/proc_sysctl.c19
-rw-r--r--fs/proc/vmcore.c15
7 files changed, 39 insertions, 46 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index f3b133d79914..69078c7cef1f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -73,6 +73,7 @@
73#include <linux/security.h> 73#include <linux/security.h>
74#include <linux/ptrace.h> 74#include <linux/ptrace.h>
75#include <linux/tracehook.h> 75#include <linux/tracehook.h>
76#include <linux/printk.h>
76#include <linux/cgroup.h> 77#include <linux/cgroup.h>
77#include <linux/cpuset.h> 78#include <linux/cpuset.h>
78#include <linux/audit.h> 79#include <linux/audit.h>
@@ -952,7 +953,7 @@ static ssize_t oom_adj_write(struct file *file, const char __user *buf,
952 * /proc/pid/oom_adj is provided for legacy purposes, ask users to use 953 * /proc/pid/oom_adj is provided for legacy purposes, ask users to use
953 * /proc/pid/oom_score_adj instead. 954 * /proc/pid/oom_score_adj instead.
954 */ 955 */
955 printk_once(KERN_WARNING "%s (%d): /proc/%d/oom_adj is deprecated, please use /proc/%d/oom_score_adj instead.\n", 956 pr_warn_once("%s (%d): /proc/%d/oom_adj is deprecated, please use /proc/%d/oom_score_adj instead.\n",
956 current->comm, task_pid_nr(current), task_pid_nr(task), 957 current->comm, task_pid_nr(current), task_pid_nr(task),
957 task_pid_nr(task)); 958 task_pid_nr(task));
958 959
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 2983dc52ca25..4b3b3ffb52f1 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -15,6 +15,7 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/printk.h>
18#include <linux/mount.h> 19#include <linux/mount.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/idr.h> 21#include <linux/idr.h>
@@ -132,11 +133,8 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
132 } 133 }
133 134
134 if (start == NULL) { 135 if (start == NULL) {
135 if (n > PAGE_SIZE) { 136 if (n > PAGE_SIZE) /* Apparent buffer overflow */
136 printk(KERN_ERR
137 "proc_file_read: Apparent buffer overflow!\n");
138 n = PAGE_SIZE; 137 n = PAGE_SIZE;
139 }
140 n -= *ppos; 138 n -= *ppos;
141 if (n <= 0) 139 if (n <= 0)
142 break; 140 break;
@@ -144,26 +142,19 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
144 n = count; 142 n = count;
145 start = page + *ppos; 143 start = page + *ppos;
146 } else if (start < page) { 144 } else if (start < page) {
147 if (n > PAGE_SIZE) { 145 if (n > PAGE_SIZE) /* Apparent buffer overflow */
148 printk(KERN_ERR
149 "proc_file_read: Apparent buffer overflow!\n");
150 n = PAGE_SIZE; 146 n = PAGE_SIZE;
151 }
152 if (n > count) { 147 if (n > count) {
153 /* 148 /*
154 * Don't reduce n because doing so might 149 * Don't reduce n because doing so might
155 * cut off part of a data block. 150 * cut off part of a data block.
156 */ 151 */
157 printk(KERN_WARNING 152 pr_warn("proc_file_read: count exceeded\n");
158 "proc_file_read: Read count exceeded\n");
159 } 153 }
160 } else /* start >= page */ { 154 } else /* start >= page */ {
161 unsigned long startoff = (unsigned long)(start - page); 155 unsigned long startoff = (unsigned long)(start - page);
162 if (n > (PAGE_SIZE - startoff)) { 156 if (n > (PAGE_SIZE - startoff)) /* buffer overflow? */
163 printk(KERN_ERR
164 "proc_file_read: Apparent buffer overflow!\n");
165 n = PAGE_SIZE - startoff; 157 n = PAGE_SIZE - startoff;
166 }
167 if (n > count) 158 if (n > count)
168 n = count; 159 n = count;
169 } 160 }
@@ -569,7 +560,7 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
569 560
570 for (tmp = dir->subdir; tmp; tmp = tmp->next) 561 for (tmp = dir->subdir; tmp; tmp = tmp->next)
571 if (strcmp(tmp->name, dp->name) == 0) { 562 if (strcmp(tmp->name, dp->name) == 0) {
572 WARN(1, KERN_WARNING "proc_dir_entry '%s/%s' already registered\n", 563 WARN(1, "proc_dir_entry '%s/%s' already registered\n",
573 dir->name, dp->name); 564 dir->name, dp->name);
574 break; 565 break;
575 } 566 }
@@ -830,9 +821,9 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
830 if (S_ISDIR(de->mode)) 821 if (S_ISDIR(de->mode))
831 parent->nlink--; 822 parent->nlink--;
832 de->nlink = 0; 823 de->nlink = 0;
833 WARN(de->subdir, KERN_WARNING "%s: removing non-empty directory " 824 WARN(de->subdir, "%s: removing non-empty directory "
834 "'%s/%s', leaking at least '%s'\n", __func__, 825 "'%s/%s', leaking at least '%s'\n", __func__,
835 de->parent->name, de->name, de->subdir->name); 826 de->parent->name, de->name, de->subdir->name);
836 pde_put(de); 827 pde_put(de);
837} 828}
838EXPORT_SYMBOL(remove_proc_entry); 829EXPORT_SYMBOL(remove_proc_entry);
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 70322e1a4f0f..a86aebc9ba7c 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -13,6 +13,7 @@
13#include <linux/stat.h> 13#include <linux/stat.h>
14#include <linux/completion.h> 14#include <linux/completion.h>
15#include <linux/poll.h> 15#include <linux/poll.h>
16#include <linux/printk.h>
16#include <linux/file.h> 17#include <linux/file.h>
17#include <linux/limits.h> 18#include <linux/limits.h>
18#include <linux/init.h> 19#include <linux/init.h>
@@ -495,13 +496,13 @@ int proc_fill_super(struct super_block *s)
495 pde_get(&proc_root); 496 pde_get(&proc_root);
496 root_inode = proc_get_inode(s, &proc_root); 497 root_inode = proc_get_inode(s, &proc_root);
497 if (!root_inode) { 498 if (!root_inode) {
498 printk(KERN_ERR "proc_fill_super: get root inode failed\n"); 499 pr_err("proc_fill_super: get root inode failed\n");
499 return -ENOMEM; 500 return -ENOMEM;
500 } 501 }
501 502
502 s->s_root = d_make_root(root_inode); 503 s->s_root = d_make_root(root_inode);
503 if (!s->s_root) { 504 if (!s->s_root) {
504 printk(KERN_ERR "proc_fill_super: allocate dentry failed\n"); 505 pr_err("proc_fill_super: allocate dentry failed\n");
505 return -ENOMEM; 506 return -ENOMEM;
506 } 507 }
507 508
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index e96d4f18ca3a..eda6f017f272 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -17,6 +17,7 @@
17#include <linux/elfcore.h> 17#include <linux/elfcore.h>
18#include <linux/vmalloc.h> 18#include <linux/vmalloc.h>
19#include <linux/highmem.h> 19#include <linux/highmem.h>
20#include <linux/printk.h>
20#include <linux/bootmem.h> 21#include <linux/bootmem.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
@@ -619,7 +620,7 @@ static int __init proc_kcore_init(void)
619 proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, 620 proc_root_kcore = proc_create("kcore", S_IRUSR, NULL,
620 &proc_kcore_operations); 621 &proc_kcore_operations);
621 if (!proc_root_kcore) { 622 if (!proc_root_kcore) {
622 printk(KERN_ERR "couldn't create /proc/kcore\n"); 623 pr_err("couldn't create /proc/kcore\n");
623 return 0; /* Always returns 0. */ 624 return 0; /* Always returns 0. */
624 } 625 }
625 /* Store text area if it's special */ 626 /* Store text area if it's special */
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c
index de20ec480fa0..30b590f5bd35 100644
--- a/fs/proc/proc_devtree.c
+++ b/fs/proc/proc_devtree.c
@@ -8,6 +8,7 @@
8#include <linux/time.h> 8#include <linux/time.h>
9#include <linux/proc_fs.h> 9#include <linux/proc_fs.h>
10#include <linux/seq_file.h> 10#include <linux/seq_file.h>
11#include <linux/printk.h>
11#include <linux/stat.h> 12#include <linux/stat.h>
12#include <linux/string.h> 13#include <linux/string.h>
13#include <linux/of.h> 14#include <linux/of.h>
@@ -110,8 +111,8 @@ void proc_device_tree_update_prop(struct proc_dir_entry *pde,
110 if (ent->data == oldprop) 111 if (ent->data == oldprop)
111 break; 112 break;
112 if (ent == NULL) { 113 if (ent == NULL) {
113 printk(KERN_WARNING "device-tree: property \"%s\" " 114 pr_warn("device-tree: property \"%s\" does not exist\n",
114 " does not exist\n", oldprop->name); 115 oldprop->name);
115 } else { 116 } else {
116 ent->data = newprop; 117 ent->data = newprop;
117 ent->size = newprop->length; 118 ent->size = newprop->length;
@@ -153,8 +154,8 @@ static const char *fixup_name(struct device_node *np, struct proc_dir_entry *de,
153realloc: 154realloc:
154 fixed_name = kmalloc(fixup_len, GFP_KERNEL); 155 fixed_name = kmalloc(fixup_len, GFP_KERNEL);
155 if (fixed_name == NULL) { 156 if (fixed_name == NULL) {
156 printk(KERN_ERR "device-tree: Out of memory trying to fixup " 157 pr_err("device-tree: Out of memory trying to fixup "
157 "name \"%s\"\n", name); 158 "name \"%s\"\n", name);
158 return name; 159 return name;
159 } 160 }
160 161
@@ -175,8 +176,8 @@ retry:
175 goto retry; 176 goto retry;
176 } 177 }
177 178
178 printk(KERN_WARNING "device-tree: Duplicate name in %s, " 179 pr_warn("device-tree: Duplicate name in %s, renamed to \"%s\"\n",
179 "renamed to \"%s\"\n", np->full_name, fixed_name); 180 np->full_name, fixed_name);
180 181
181 return fixed_name; 182 return fixed_name;
182} 183}
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 612df79cc6a1..ac05f33a0dde 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -5,6 +5,7 @@
5#include <linux/sysctl.h> 5#include <linux/sysctl.h>
6#include <linux/poll.h> 6#include <linux/poll.h>
7#include <linux/proc_fs.h> 7#include <linux/proc_fs.h>
8#include <linux/printk.h>
8#include <linux/security.h> 9#include <linux/security.h>
9#include <linux/sched.h> 10#include <linux/sched.h>
10#include <linux/namei.h> 11#include <linux/namei.h>
@@ -57,7 +58,7 @@ static void sysctl_print_dir(struct ctl_dir *dir)
57{ 58{
58 if (dir->header.parent) 59 if (dir->header.parent)
59 sysctl_print_dir(dir->header.parent); 60 sysctl_print_dir(dir->header.parent);
60 printk(KERN_CONT "%s/", dir->header.ctl_table[0].procname); 61 pr_cont("%s/", dir->header.ctl_table[0].procname);
61} 62}
62 63
63static int namecmp(const char *name1, int len1, const char *name2, int len2) 64static int namecmp(const char *name1, int len1, const char *name2, int len2)
@@ -134,9 +135,9 @@ static int insert_entry(struct ctl_table_header *head, struct ctl_table *entry)
134 else if (cmp > 0) 135 else if (cmp > 0)
135 p = &(*p)->rb_right; 136 p = &(*p)->rb_right;
136 else { 137 else {
137 printk(KERN_ERR "sysctl duplicate entry: "); 138 pr_err("sysctl duplicate entry: ");
138 sysctl_print_dir(head->parent); 139 sysctl_print_dir(head->parent);
139 printk(KERN_CONT "/%s\n", entry->procname); 140 pr_cont("/%s\n", entry->procname);
140 return -EEXIST; 141 return -EEXIST;
141 } 142 }
142 } 143 }
@@ -927,9 +928,9 @@ found:
927 subdir->header.nreg++; 928 subdir->header.nreg++;
928failed: 929failed:
929 if (unlikely(IS_ERR(subdir))) { 930 if (unlikely(IS_ERR(subdir))) {
930 printk(KERN_ERR "sysctl could not get directory: "); 931 pr_err("sysctl could not get directory: ");
931 sysctl_print_dir(dir); 932 sysctl_print_dir(dir);
932 printk(KERN_CONT "/%*.*s %ld\n", 933 pr_cont("/%*.*s %ld\n",
933 namelen, namelen, name, PTR_ERR(subdir)); 934 namelen, namelen, name, PTR_ERR(subdir));
934 } 935 }
935 drop_sysctl_table(&dir->header); 936 drop_sysctl_table(&dir->header);
@@ -995,8 +996,8 @@ static int sysctl_err(const char *path, struct ctl_table *table, char *fmt, ...)
995 vaf.fmt = fmt; 996 vaf.fmt = fmt;
996 vaf.va = &args; 997 vaf.va = &args;
997 998
998 printk(KERN_ERR "sysctl table check failed: %s/%s %pV\n", 999 pr_err("sysctl table check failed: %s/%s %pV\n",
999 path, table->procname, &vaf); 1000 path, table->procname, &vaf);
1000 1001
1001 va_end(args); 1002 va_end(args);
1002 return -EINVAL; 1003 return -EINVAL;
@@ -1510,9 +1511,9 @@ static void put_links(struct ctl_table_header *header)
1510 drop_sysctl_table(link_head); 1511 drop_sysctl_table(link_head);
1511 } 1512 }
1512 else { 1513 else {
1513 printk(KERN_ERR "sysctl link missing during unregister: "); 1514 pr_err("sysctl link missing during unregister: ");
1514 sysctl_print_dir(parent); 1515 sysctl_print_dir(parent);
1515 printk(KERN_CONT "/%s\n", name); 1516 pr_cont("/%s\n", name);
1516 } 1517 }
1517 } 1518 }
1518} 1519}
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index 0d5071d29985..41dd018f72dd 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -15,6 +15,7 @@
15#include <linux/export.h> 15#include <linux/export.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/highmem.h> 17#include <linux/highmem.h>
18#include <linux/printk.h>
18#include <linux/bootmem.h> 19#include <linux/bootmem.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/crash_dump.h> 21#include <linux/crash_dump.h>
@@ -553,8 +554,7 @@ static int __init parse_crash_elf64_headers(void)
553 ehdr.e_ehsize != sizeof(Elf64_Ehdr) || 554 ehdr.e_ehsize != sizeof(Elf64_Ehdr) ||
554 ehdr.e_phentsize != sizeof(Elf64_Phdr) || 555 ehdr.e_phentsize != sizeof(Elf64_Phdr) ||
555 ehdr.e_phnum == 0) { 556 ehdr.e_phnum == 0) {
556 printk(KERN_WARNING "Warning: Core image elf header is not" 557 pr_warn("Warning: Core image elf header is not sane\n");
557 "sane\n");
558 return -EINVAL; 558 return -EINVAL;
559 } 559 }
560 560
@@ -609,8 +609,7 @@ static int __init parse_crash_elf32_headers(void)
609 ehdr.e_ehsize != sizeof(Elf32_Ehdr) || 609 ehdr.e_ehsize != sizeof(Elf32_Ehdr) ||
610 ehdr.e_phentsize != sizeof(Elf32_Phdr) || 610 ehdr.e_phentsize != sizeof(Elf32_Phdr) ||
611 ehdr.e_phnum == 0) { 611 ehdr.e_phnum == 0) {
612 printk(KERN_WARNING "Warning: Core image elf header is not" 612 pr_warn("Warning: Core image elf header is not sane\n");
613 "sane\n");
614 return -EINVAL; 613 return -EINVAL;
615 } 614 }
616 615
@@ -653,8 +652,7 @@ static int __init parse_crash_elf_headers(void)
653 if (rc < 0) 652 if (rc < 0)
654 return rc; 653 return rc;
655 if (memcmp(e_ident, ELFMAG, SELFMAG) != 0) { 654 if (memcmp(e_ident, ELFMAG, SELFMAG) != 0) {
656 printk(KERN_WARNING "Warning: Core image elf header" 655 pr_warn("Warning: Core image elf header not found\n");
657 " not found\n");
658 return -EINVAL; 656 return -EINVAL;
659 } 657 }
660 658
@@ -673,8 +671,7 @@ static int __init parse_crash_elf_headers(void)
673 /* Determine vmcore size. */ 671 /* Determine vmcore size. */
674 vmcore_size = get_vmcore_size_elf32(elfcorebuf); 672 vmcore_size = get_vmcore_size_elf32(elfcorebuf);
675 } else { 673 } else {
676 printk(KERN_WARNING "Warning: Core image elf header is not" 674 pr_warn("Warning: Core image elf header is not sane\n");
677 " sane\n");
678 return -EINVAL; 675 return -EINVAL;
679 } 676 }
680 return 0; 677 return 0;
@@ -690,7 +687,7 @@ static int __init vmcore_init(void)
690 return rc; 687 return rc;
691 rc = parse_crash_elf_headers(); 688 rc = parse_crash_elf_headers();
692 if (rc) { 689 if (rc) {
693 printk(KERN_WARNING "Kdump: vmcore not initialized\n"); 690 pr_warn("Kdump: vmcore not initialized\n");
694 return rc; 691 return rc;
695 } 692 }
696 693