Skip to content
  • Mark Rutland's avatar
    arm64: mm: dump: fix shift warning · 35545f0c
    Mark Rutland authored
    
    
    When building with 48-bit VAs, it's possible to get the following
    warning when building the arm64 page table dumping code:
    
    arch/arm64/mm/dump.c: In function ‘walk_pgd’:
    arch/arm64/mm/dump.c:266:2: warning: right shift count >= width of type
      pgd_t *pgd = pgd_offset(mm, 0);
      ^
    
    As pgd_offset is a macro and the second argument is not cast to any
    particular type, the zero will be given integer type by the compiler.
    As pgd_offset passes the pargument to pgd_index, we then try to shift
    the 32-bit integer by at least 39 bits (for 4k pages).
    
    Elsewhere the pgd_offset is passed a second argument of unsigned long
    type, so let's do the same here by passing '0UL' rather than '0'.
    
    Cc: Kees Cook <keescook@chromium.org>
    Acked-by: default avatarLaura Abbott <lauraa@codeaurora.org>
    Acked-by: default avatarSteve Capper <steve.capper@arm.com>
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    35545f0c