Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Michael <fedora.dm0@gmail.com>
To: linux-erofs@lists.ozlabs.org
Subject: [PATCH] erofs-utils: dump: fix format errors on some architectures
Date: Sun, 21 Nov 2021 17:23:26 -0500	[thread overview]
Message-ID: <87tug5jggx.fsf@gmail.com> (raw)

This applies the same type casting to nid values as is done in the
other formatting function calls to avoid this error:

    In file included from main.c:11:
    main.c: In function 'erofs_checkdirent':
    ../include/erofs/print.h:68:25: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__le64' {aka 'long unsigned int'} [-Werror=format=]
       68 |                         "<E> " PR_FMT_FUNC_LINE(fmt),   \
          |                         ^~~~~~
    main.c:264:17: note: in expansion of macro 'erofs_err'
      264 |                 erofs_err("invalid file type %llu", de->nid);
          |                 ^~~~~~~~~
    main.c: In function 'erofs_read_dirent':
    ../include/erofs/print.h:68:25: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__le64' {aka 'long unsigned int'} [-Werror=format=]
       68 |                         "<E> " PR_FMT_FUNC_LINE(fmt),   \
          |                         ^~~~~~
    main.c:303:25: note: in expansion of macro 'erofs_err'
      303 |                         erofs_err("parse dir nid %llu error occurred\n",
          |                         ^~~~~~~~~
    cc1: all warnings being treated as errors

Signed-off-by: David Michael <fedora.dm0@gmail.com>
---

Hi,

I hit this build failure on powerpc64le when trying the 1.4 release.
Can something like this be applied to get around it?

Thanks.

David

 dump/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dump/main.c b/dump/main.c
index b7560ec..6f5b9e7 100644
--- a/dump/main.c
+++ b/dump/main.c
@@ -261,7 +261,7 @@ static inline int erofs_checkdirent(struct erofs_dirent *de,
 		return -EFSCORRUPTED;
 	}
 	if (de->file_type >= EROFS_FT_MAX) {
-		erofs_err("invalid file type %llu", de->nid);
+		erofs_err("invalid file type %llu", de->nid | 0ULL);
 		return -EFSCORRUPTED;
 	}
 	return dname_len;
@@ -301,7 +301,7 @@ static int erofs_read_dirent(struct erofs_dirent *de,
 		err = erofs_read_dir(de->nid, nid);
 		if (err) {
 			erofs_err("parse dir nid %llu error occurred\n",
-					de->nid);
+					de->nid | 0ULL);
 			return err;
 		}
 	}
-- 
2.31.1


             reply	other threads:[~2021-11-21 22:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-21 22:23 David Michael [this message]
2021-11-21 23:48 ` [PATCH] erofs-utils: dump: fix de->nid issues Gao Xiang

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=87tug5jggx.fsf@gmail.com \
    --to=fedora.dm0@gmail.com \
    --cc=linux-erofs@lists.ozlabs.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