Re: [PATCH] fbdev: suppress warning when assigning vga-save/restorebase

From: H. Peter Anvin
Date: Sun Aug 04 2013 - 13:34:43 EST


On 08/04/2013 10:25 AM, David Herrmann wrote:
> If drivers use "struct resource" objects to retrieve the vga-base, they
> must correctly cast the integer to pointer. With x86+PAE we have 32bit
> pointers but 64bit resource_size_t. Hence, cast it to "unsigned long"
> before casting to "void*" to suppress warnings due to size differences.
>
> As IO addresses are always low addresses, we can safely drop the higher
> part of the address. This is what these drivers did before, anyway.
>
> Signed-off-by: David Herrmann <dh.herrmann@xxxxxxxxx>
> Reported-by: H. Peter Anvin <hpa@xxxxxxxxx>

I'm still bothered here. Casting between resource_size_t and void *
implies a confusion between physical and virtual addresses. That may be
unavoidable for some reason, but I'd like to know what exactly is confused.

Anyone who can dig backwards and summarize? In other words:

Where in the current code do we stuff a physical address in a pointer,
or a virtual address into a non-pointer?

-hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/