mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/4] sandbox: os: common: fix compiler warning in add_image()
Date: Mon,  6 Jul 2020 08:28:04 +0200	[thread overview]
Message-ID: <20200706062805.26278-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200706062805.26278-1-a.fatoum@pengutronix.de>

GCC reports:

  ./arch/sandbox/os/common.c: In function ‘add_image’:
  ./arch/sandbox/os/common.c:271:6: warning: cast to pointer from integer of
  	different size [-Wint-to-pointer-cast]

This is because hf->base is an unsigned long long, with the upper 32 bit
all-zeroes on 32-bit systems. The compiler doesn't see that though.

Change the cast, so we no longer warn.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/sandbox/os/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index 382a92304020..534571c0e668 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -268,7 +268,7 @@ static int add_image(char *str, char *devname_template, int *devname_number)
 	hf->base = (unsigned long)mmap(NULL, hf->size,
 			PROT_READ | (readonly ? 0 : PROT_WRITE),
 			MAP_SHARED, fd, 0);
-	if ((void *)hf->base == MAP_FAILED)
+	if (hf->base == (unsigned long)MAP_FAILED)
 		printf("warning: mmapping %s failed: %s\n", filename, strerror(errno));
 
 	ret = barebox_register_filedev(hf);
-- 
2.27.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-07-06  6:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06  6:28 [PATCH 1/4] sandbox: include: <asm/types.h>: don't define INTERNAL_SIZE_T Ahmad Fatoum
2020-07-06  6:28 ` Ahmad Fatoum [this message]
2020-07-06  6:28 ` [PATCH 3/4] sandbox: add libc memory allocator Ahmad Fatoum
2020-07-06  6:28 ` [PATCH 4/4] sandbox: reinstate cooked terminal mode on sanitizer-induced death Ahmad Fatoum
2020-07-11  4:34 ` [PATCH 1/4] sandbox: include: <asm/types.h>: don't define INTERNAL_SIZE_T Sascha Hauer

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=20200706062805.26278-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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