+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 :-)
You have to consider those possible values before you see it cannot
overflow. So no, it's a lot _less_ readable IMHO.
It's also a dangerous habit to get into. Just say no :-)
Segher
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev