From: Arnd Bergmann <arnd@arndb.de>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Arnd Bergmann <arnd@arndb.de>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] fat: fix sector print
Date: Fri, 8 Jun 2018 16:38:52 +0200 [thread overview]
Message-ID: <20180608143907.2620349-1-arnd@arndb.de> (raw)
Printing a sector_t using %ld fails when that is a 64-bit type on
32-bit architectures:
fs/fat/inode.c: In function '__fat_get_block':
fs/fat/inode.c:163:9: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'sector_t' {aka 'long long unsigned int'} [-Werror=format=]
"invalid FAT chain (i_pos %lld, last_block %ld)",
The common workaround is to cast the number to a 64-bit type and print that
as %lld, that works in all configurations.
Fixes: mmotm ("fat: use fat_fs_error() instead of BUG_ON() in __fat_get_block()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
fs/fat/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index d380d0f844bb..d168df5a4a73 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -160,8 +160,8 @@ static inline int __fat_get_block(struct inode *inode, sector_t iblock,
return err;
if (!phys) {
fat_fs_error(sb,
- "invalid FAT chain (i_pos %lld, last_block %ld)",
- MSDOS_I(inode)->i_pos, last_block);
+ "invalid FAT chain (i_pos %lld, last_block %llu)",
+ MSDOS_I(inode)->i_pos, (u64)last_block);
return -EIO;
}
--
2.9.0
reply other threads:[~2018-06-08 14:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180608143907.2620349-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®