[PATCH master 6/7] meminfo: avoid out-of-bounds compiler warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



GCC warns about _etext and __bss_stop being arrays whose starting address
is subtracted by one. The arrays are linker defined and subtracting them
is fine, so silence the warning by casting the pointer to an equally
sized integer with no limitations on arithmetic.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 common/meminfo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/meminfo.c b/common/meminfo.c
index f4994959b6ae..3ceb0ba4cf25 100644
--- a/common/meminfo.c
+++ b/common/meminfo.c
@@ -13,8 +13,8 @@ static int display_meminfo(void)
 	ulong msize  = mend - mstart + 1;
 
 	if (!IS_ENABLED(CONFIG_SANDBOX)) {
-		pr_debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext - 1);
-		pr_debug("bss segment:  0x%p -> 0x%p\n", __bss_start, __bss_stop - 1);
+		pr_debug("barebox code: 0x%lx -> 0x%lx\n", (ulong)_stext, (ulong)_etext - 1);
+		pr_debug("bss segment:  0x%lx -> 0x%lx\n", (ulong)__bss_start, (ulong)__bss_stop - 1);
 	}
 	pr_info("malloc space: 0x%08lx -> 0x%08lx (size %s)\n",
 		mstart, mend, size_human_readable(msize));
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux