Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544530 > unrolled thread

[PATCH 1/1] xfs: silent -Wformat-security warning

Started byNicolas Iooss <nicolas.iooss_linux@m4x.org>
First post2016-12-19 14:50 +0100
Last post2016-12-19 17:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] xfs: silent -Wformat-security warning Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2016-12-19 14:50 +0100
    Re: [PATCH 1/1] xfs: silent -Wformat-security warning Christoph Hellwig <hch@infradead.org> - 2016-12-19 17:10 +0100

#1544530 — [PATCH 1/1] xfs: silent -Wformat-security warning

FromNicolas Iooss <nicolas.iooss_linux@m4x.org>
Date2016-12-19 14:50 +0100
Subject[PATCH 1/1] xfs: silent -Wformat-security warning
Message-ID<sQ6ud-8qH-5@gated-at.bofh.it>
When building the XFS driver with clang, the compiler reports a
-Wformat-security warning in xlog_recover_validate_buf_type() because
xfs_warn() is being called with a non-literal string. Even though
variable warnmsg is always initialized as a constant string without any
'%' character, silent the warning by calling xfs_warn with "%s" format
string.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 fs/xfs/xfs_log_recover.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 4a98762ec8b4..9208296e9f15 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2572,7 +2572,7 @@ xlog_recover_validate_buf_type(
 		return;
 
 	if (warnmsg) {
-		xfs_warn(mp, warnmsg);
+		xfs_warn(mp, "%s", warnmsg);
 		ASSERT(0);
 	}
 
-- 
2.11.0

[toc] | [next] | [standalone]


#1544631

FromChristoph Hellwig <hch@infradead.org>
Date2016-12-19 17:10 +0100
Message-ID<sQ8FH-1Hm-35@gated-at.bofh.it>
In reply to#1544530
On Mon, Dec 19, 2016 at 02:41:11PM +0100, Nicolas Iooss wrote:
> When building the XFS driver with clang, the compiler reports a
> -Wformat-security warning in xlog_recover_validate_buf_type() because
> xfs_warn() is being called with a non-literal string. Even though
> variable warnmsg is always initialized as a constant string without any
> '%' character, silent the warning by calling xfs_warn with "%s" format
> string.
> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

Looks fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web