Use unsigned intptr_t type for framebuffer addresses

Summary:
Some architectures (powerpc Book-E) have a vm_paddr_t larger than intptr_t.
Casting from the intptr_t to vm_paddr_t causes sign extension, leading to a
potentially invalid address.

This was seen when running X on a PowerPC P1022 machine, which mapped the
backing framebuffer at 0xc1800000.  When mmap()d by X, this yielded an invalid
address of 0xffffffffc1800000, or, as the hardware would see it, 0xfc1800000.

Reviewed By: ray
Differential Revision: https://reviews.freebsd.org/D13332
This commit is contained in:
Justin Hibbits 2017-12-06 02:05:21 +00:00
parent e294a1269f
commit 97d24081da
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326611

View File

@ -136,8 +136,8 @@ struct fb_info {
fb_leave_t *leave;
fb_setblankmode_t *setblankmode;
intptr_t fb_pbase; /* For FB mmap. */
intptr_t fb_vbase; /* if NULL, use fb_write/fb_read. */
uintptr_t fb_pbase; /* For FB mmap. */
uintptr_t fb_vbase; /* if NULL, use fb_write/fb_read. */
void *fb_priv; /* First argument for read/write. */
const char *fb_name;
uint32_t fb_flags;