diff mbox

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

Message ID 20161219134111.5267-1-nicolas.iooss_linux@m4x.org
State New, archived
Headers show

Commit Message

Nicolas Iooss Dec. 19, 2016, 1:41 p.m. UTC
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(-)

Comments

Christoph Hellwig Dec. 19, 2016, 4:05 p.m. UTC | #1
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>
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);
 	}