kern/mm: Use %x and cast for displaying sizeof()

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>
This commit is contained in:
Vladimir Serbinenko 2023-08-25 13:37:43 +02:00 committed by Daniel Kiper
parent b3d49a697b
commit 6d2aa7ee01

View 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)
{