Re: [PATCH v3 1/4] ozwpan: Use proper check to prevent heap overflow

From: Jason A. Donenfeld
Date: Fri May 29 2015 - 11:22:01 EST


On Fri, May 29, 2015 at 2:36 PM, Frans Klaver <fransklaver@xxxxxxxxx> wrote:
>
> I would say that it is because part of the expression has been placed
> inside parentheses:
>
> a - b + 1 == a - (b - 1)
>
> Guess it makes the decision logic slightly more readable.

Yes, exactly this. It's so that the bounding check conditional prior
looks identical to the actual subtraction, making it much easier to
read and verify.
--
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/