Rusty Russell <[EMAIL PROTECTED]> wrote:

> You're the second one to ask this.  I'm pretty sure it's still right
> (and it's what the old code used to do).

On reconsideration, I'll withdraw my objection.  I think you're right.

> Consider the case where limit is 0xC0000000, val is 0xBFFFFFFF and len
> is 1.

Better still, consider val=0, len=1 and limit=1 as it's much easier to do in
one's head.  I was thinking about the limit case only (I could see wrap-around
is taken care of).


It might be better to call your function something like limit_check().  You
don't really mean val_outside() you mean range_outside() or something.


Also, I agree that having a standard function to detect it is a good thing to
do.  We have to make this check so often, and occasionally it's got wrong.

A further thought for you... might it be worth having a wrapper macro that
casts the val argument (and possibly the limit) to unsigned long?  Quite often
what you want to check are pointers.


Anyway:

Acked-By: David Howells <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to