Skip to content

Commit 48dbc12

Browse files
fs/ntfs3: Format output messages like others fs in kernel
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent 031d6f6 commit 48dbc12

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

fs/ntfs3/super.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void ntfs_printk(const struct super_block *sb, const char *fmt, ...)
9090
level = printk_get_level(fmt);
9191
vaf.fmt = printk_skip_level(fmt);
9292
vaf.va = &args;
93-
printk("%c%cntfs3: %s: %pV\n", KERN_SOH_ASCII, level, sb->s_id, &vaf);
93+
printk("%c%cntfs3(%s): %pV\n", KERN_SOH_ASCII, level, sb->s_id, &vaf);
9494

9595
va_end(args);
9696
}
@@ -124,10 +124,15 @@ void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
124124
struct dentry *de = d_find_alias(inode);
125125

126126
if (de) {
127+
int len;
127128
spin_lock(&de->d_lock);
128-
snprintf(name, sizeof(s_name_buf), " \"%s\"",
129-
de->d_name.name);
129+
len = snprintf(name, sizeof(s_name_buf), " \"%s\"",
130+
de->d_name.name);
130131
spin_unlock(&de->d_lock);
132+
if (len <= 0)
133+
name[0] = 0;
134+
else if (len >= sizeof(s_name_buf))
135+
name[sizeof(s_name_buf) - 1] = 0;
131136
} else {
132137
name[0] = 0;
133138
}
@@ -140,7 +145,7 @@ void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
140145
vaf.fmt = printk_skip_level(fmt);
141146
vaf.va = &args;
142147

143-
printk("%c%cntfs3: %s: ino=%lx,%s %pV\n", KERN_SOH_ASCII, level,
148+
printk("%c%cntfs3(%s): ino=%lx,%s %pV\n", KERN_SOH_ASCII, level,
144149
sb->s_id, inode->i_ino, name ? name : "", &vaf);
145150

146151
va_end(args);

0 commit comments

Comments
 (0)