linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: Fix format specifier for max_folio_size in xfs_fs_fill_super()
@ 2024-08-27 23:15 Nathan Chancellor
  2024-08-27 23:47 ` Darrick J. Wong
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Nathan Chancellor @ 2024-08-27 23:15 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Chandan Babu R, Darrick J. Wong, Pankaj Raghav, Luis Chamberlain,
	Dave Chinner, linux-xfs, linux-fsdevel, patches,
	Nathan Chancellor

When building for a 32-bit architecture, where 'size_t' is 'unsigned
int', there is a warning due to use of '%ld', the specifier for a 'long
int':

  In file included from fs/xfs/xfs_linux.h:82,
                   from fs/xfs/xfs.h:26,
                   from fs/xfs/xfs_super.c:7:
  fs/xfs/xfs_super.c: In function 'xfs_fs_fill_super':
  fs/xfs/xfs_super.c:1654:1: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
   1654 | "block size (%u bytes) not supported; Only block size (%ld) or less is supported",
        | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1655 |                                 mp->m_sb.sb_blocksize, max_folio_size);
        |                                                        ~~~~~~~~~~~~~~
        |                                                        |
        |                                                        size_t {aka unsigned int}
  ...
  fs/xfs/xfs_super.c:1654:58: note: format string is defined here
   1654 | "block size (%u bytes) not supported; Only block size (%ld) or less is supported",
        |                                                        ~~^
        |                                                          |
        |                                                          long int
        |                                                        %d

Use the proper 'size_t' specifier, '%zu', to resolve the warning.

Fixes: 0ab3ca31b012 ("xfs: enable block size larger than page size support")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 fs/xfs/xfs_super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 242271298a33..e8cc7900911e 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1651,7 +1651,7 @@ xfs_fs_fill_super(
 
 		if (mp->m_sb.sb_blocksize > max_folio_size) {
 			xfs_warn(mp,
-"block size (%u bytes) not supported; Only block size (%ld) or less is supported",
+"block size (%u bytes) not supported; Only block size (%zu) or less is supported",
 				mp->m_sb.sb_blocksize, max_folio_size);
 			error = -ENOSYS;
 			goto out_free_sb;

---
base-commit: f143d1a48d6ecce12f5bced0d18a10a0294726b5
change-id: 20240827-xfs-fix-wformat-bs-gt-ps-967f3aa1c142

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-09-03 13:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 23:15 [PATCH] xfs: Fix format specifier for max_folio_size in xfs_fs_fill_super() Nathan Chancellor
2024-08-27 23:47 ` Darrick J. Wong
2024-08-28 10:23 ` Pankaj Raghav (Samsung)
2024-08-28 21:26 ` Luis Chamberlain
2024-08-29  3:46 ` Matthew Wilcox
2024-08-29  5:20   ` Darrick J. Wong
2024-08-29 17:50   ` Nathan Chancellor
2024-09-03 13:02 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).