]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
kern/mm: Use %x and cast for displaying sizeof()
authorVladimir Serbinenko <phcoder@gmail.com>
Fri, 25 Aug 2023 11:37:43 +0000 (13:37 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 13 Dec 2023 12:18:42 +0000 (13:18 +0100)
There is some variance in how compiler treats sizeof() especially
on 32-bit platforms where it can be naturally either int or long.
Explicit cast solves the issue.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/kern/mm.c

index 792ab0a836b5cbfd098e1c6a7cb49ef837724d8c..027a25cd1f002cf1282f5b7e8308c10db59edce0 100644 (file)
@@ -238,8 +238,8 @@ grub_mm_init_region (void *addr, grub_size_t size)
        *   |<q region>|-q->post_size-|----size-----|
        */
       grub_dprintf ("regions", "Can we extend into region below?"
-                    " %p + %" PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " ?=? %p\n",
-                    (grub_uint8_t *) q, sizeof(*q), q->size, q->post_size, (grub_uint8_t *) addr);
+                    " %p + %x + %" PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " ?=? %p\n",
+                    (grub_uint8_t *) q, (int) sizeof (*q), q->size, q->post_size, (grub_uint8_t *) addr);
       if ((grub_uint8_t *) q + sizeof (*q) + q->size + q->post_size ==
          (grub_uint8_t *) addr)
        {