Thread (4 messages) flat view 4 messages, 3 authors, 2011-12-05

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

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2011-12-04 23:18:33

On Sat, 2011-12-03 at 04:22 +0100, Segher Boessenkool wrote:
quoted
+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 :-) )
The original code is a lot more readable and perfectly correct for all
possible values of rtas_rmo_buf :-)

Cheers,
Ben.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help