[PATCH 3/3] comm: ext4: Protect task->comm access by using %ptc

John Stultz
2011-05-11T00:23:16Z

Converts ext4 comm access to use the safe printk %ptc accessor.

CC: Ted Ts'o <tytso@mit.edu>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: David Rientjes <rientjes@google.com>
CC: Dave Hansen <dave@linux.vnet.ibm.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-mm@kvack.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
fs/ext4/file.c | 4 ++--
fs/ext4/super.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 7b80d54..31438a0 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -126,9 +126,9 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
/* Warn about this once per day */
if (printk_timed_ratelimit(&unaligned_warn_time, 60*60*24*HZ))
ext4_msg(inode->i_sb, KERN_WARNING,
- "Unaligned AIO/DIO on inode %ld by %s; "
+ "Unaligned AIO/DIO on inode %ld by %ptc; "
"performance will be poor.",
- inode->i_ino, current->comm);
+ inode->i_ino, current);
mutex_lock(ext4_aio_mutex(inode));
ext4_aiodio_wait(inode);
}
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 8553dfb..d4ab4c0 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -413,8 +413,8 @@ void __ext4_error(struct super_block *sb, const char *function,
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
- printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: comm %s: %pV\n",
- sb->s_id, function, line, current->comm, &vaf);
+ printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: comm %ptc: %pV\n",
+ sb->s_id, function, line, current, &vaf);
va_end(args);

ext4_handle_error(sb);
@@ -438,7 +438,7 @@ void ext4_error_inode(struct inode *inode, const char *function,
inode->i_sb->s_id, function, line, inode->i_ino);
if (block)
printk(KERN_CONT "block %llu: ", block);
- printk(KERN_CONT "comm %s: %pV\n", current->comm, &vaf);
+ printk(KERN_CONT "comm %ptc: %pV\n", current, &vaf);
va_end(args);

ext4_handle_error(inode->i_sb);
@@ -468,7 +468,7 @@ void ext4_error_file(struct file *file, const char *function,
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
- printk(KERN_CONT "comm %s: path %s: %pV\n", current->comm, path, &vaf);
+ printk(KERN_CONT "comm %ptc: path %s: %pV\n", current, path, &vaf);
va_end(args);

ext4_handle_error(inode->i_sb);
--
1.7.3.2.146.gca209