diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-22 15:57:59 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-22 16:11:12 +0100 |
commit | 5d54f948aaac4a6ab6b908af379103559a5a002c (patch) | |
tree | cc9af51302a096c83b93ca8781a8f3785e906b78 /fs/sysfs | |
parent | a9afc573dbe64e27c0082f69f242d2bbe13d57f3 (diff) | |
download | linux-5d54f948aaac4a6ab6b908af379103559a5a002c.tar.bz2 |
sysfs: turn WARN() into pr_warn()
It's not good to crash the machine if panic_on_warn() is set just
because someone made a stupid mistake of trying to create a sysfs file
with the same name of an existing one. This makes the automated testing
tools a lot harder to find the real bugs in the kernel.
So just print a warning out and dump the stack to get the attention of
the developer that they did something foolish. Then keep on trucking,
as this should not be a fatal error at all.
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/dir.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 2b67bda2021b..3a36a48a4b3f 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -10,6 +10,7 @@ * Please see Documentation/filesystems/sysfs.txt for more information. */ +#define pr_fmt(fmt) "sysfs: " fmt #undef DEBUG #include <linux/fs.h> @@ -27,8 +28,8 @@ void sysfs_warn_dup(struct kernfs_node *parent, const char *name) if (buf) kernfs_path(parent, buf, PATH_MAX); - WARN(1, KERN_WARNING "sysfs: cannot create duplicate filename '%s/%s'\n", - buf, name); + pr_warn("cannot create duplicate filename '%s/%s'\n", buf, name); + dump_stack(); kfree(buf); } |