[PATCH 1/1] Punch a hole in /dev/mem for librtas

Segher Boessenkool segher at kernel.crashing.org
Sat Dec 3 14:22:59 EST 2011


> +static inline int page_is_rtas_user_buf(unsigned long pfn)
> +{
> +	unsigned long paddr = (pfn << PAGE_SHIFT);
> +	if (paddr >= rtas_rmo_buf && paddr < (rtas_rmo_buf +  
> RTAS_RMOBUF_MAX))

It probably cannot overflow with actual values of rtas_rmo_buf
and RTAS_RMOBUF_MAX, but otherwise it is an incorrect test;
please write

	if (paddr >= rtas_rmo_buf && paddr - rtas_rmo_buf < RTAS_RMOBUF_MAX)

(and, _MAX?  Shouldn't it be the actual size here?  Or is _MAX
just a confusing name :-) )


Segher



More information about the Linuxppc-dev mailing list