ubifs: Fix debug messages for an invalid filename in ubifs_dump_node
authorHyunchul Lee <cheol.lee@lge.com>
Wed, 15 Mar 2017 01:31:04 +0000 (10:31 +0900)
committerRichard Weinberger <richard@nod.at>
Thu, 30 Mar 2017 07:27:47 +0000 (09:27 +0200)
if a character is not printable, print '?' instead of that.

Signed-off-by: Hyunchul Lee <cheol.lee@lge.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/debug.c

index 1e712a36468064a75910e8ba9c0e1cfb2bd3ab28..b14c06f47a96161cfa86534e00d1d71d54074acf 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/math64.h>
 #include <linux/uaccess.h>
 #include <linux/random.h>
+#include <linux/ctype.h>
 #include "ubifs.h"
 
 static DEFINE_SPINLOCK(dbg_lock);
@@ -464,7 +465,8 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
                        pr_err("(bad name length, not printing, bad or corrupted node)");
                else {
                        for (i = 0; i < nlen && dent->name[i]; i++)
-                               pr_cont("%c", dent->name[i]);
+                               pr_cont("%c", isprint(dent->name[i]) ?
+                                       dent->name[i] : '?');
                }
                pr_cont("\n");