Skip to contentSkip to conversation

fs/ntfs: Use '%lx' instead of '%zx'

PATCH In review Chen Gang 2 participants 3 messages Jun 22, 2014 – Jun 23, 2014 NTFS filesystem

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 fs/ntfs: Use '%lx' instead of '%zx'

For subtraction between 2 pointers, the result's type is 'long', so need use '%lx' instead of '%zx'.

The related warning (allmodconfig under unicore32):

CC [M] fs/ntfs/compress.o
fs/ntfs/compress.c: In function 'ntfs_decompress':
fs/ntfs/compress.c:207:2: warning: format '%zx' expects argument of type 'size_t', but argument 5 has type 'long int' [-Wformat=]

    ntfs_debug("Beginning sub-block at offset = 0x%zx in the cb.",
    ^
    CC [M]  fs/ntfs/dir.o
  fs/ntfs/dir.c: In function 'ntfs_readdir':
  fs/ntfs/dir.c:1197:3: warning: format '%zx' expects argument of type 'size_t', but argument 5 has type 'long int' [-Wformat=]
     ntfs_debug("In index root, offset 0x%zx.", (u8*)ie - (u8*)ir);
     ^

Also let the related code match linux kernel styles which is found by 'scripts/checkpatch.pl'.

---
 fs/ntfs/compress.c | 2 +-
 fs/ntfs/dir.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/ntfs/compress.c +1 -1
index f82498c..51abeb3 100644
@@ -204,7 +204,7 @@ static int ntfs_decompress(struct page *dest_pages[], int *dest_index,
 
 	ntfs_debug("Entering, cb_size = 0x%x.", cb_size);
 do_next_sb:
-	ntfs_debug("Beginning sub-block at offset = 0x%zx in the cb.",
+	ntfs_debug("Beginning sub-block at offset = 0x%lx in the cb.",
 			cb - cb_start);
 	/*
 	 * Have we reached the end of the compression block or the end of the
fs/ntfs/dir.c +1 -1
index 9e38daf..cf85530 100644
@@ -1194,7 +1194,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor)
 	 * or signals an error (both covered by the rc test).
 	 */
 	for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
-		ntfs_debug("In index root, offset 0x%zx.", (u8*)ie - (u8*)ir);
+		ntfs_debug("In index root, offset 0x%lx.", (u8 *)ie - (u8 *)ir);
 		/* Bounds checks. */
 		if (unlikely((u8*)ie < (u8*)ir || (u8*)ie +
 				sizeof(INDEX_ENTRY_HEADER) > index_end ||
Signature · 1 line
1.9.2.459.g68773ac
#1 lore raw
Quoted 2 lines · Chen Gang

For subtraction between 2 pointers, the result's type is 'long', so need use '%lx' instead of '%zx'.

result should be a ptrdiff_t so please use %tx

author
#2 lore raw
Quoted 6 lines · Joe Perches
Quoted 2 lines · Chen Gang

For subtraction between 2 pointers, the result's type is 'long', so need use '%lx' instead of '%zx'.

result should be a ptrdiff_t so please use %tx

OK, thanks, I shall send patch v2 for it.

Thanks.

Signature · 3 lines
Chen Gang

Open, share, and attitude like air, water, and life which God blessed