Dear Michael, In message <capx6zwhln-vabzqoyamf+t2vyqec3mzdi1e_kdtvzg8okjm...@mail.gmail.com> you wrote: > > > > it's possible that these checks could be simply optimised away. The > > > > This is not hwat happens. > > Actually, it is my understanding that the "if (p + len < p)" can be > optimized away. This exact case is discussed in the LWN article "GCC and > pointer overflows"[1].
No, this does not apply here. You miss a key point. We are not doing any pointer arithmetics here. We have: int offset; unsigned int len; and then do: if (((offset + len) < offset) ...) ... > Basically, the C standard states that pointer arithmetic should not cause > overflow, thus allowing the compiler to assume that "p + len" must always > be greater than "p". This is totally irrelevant here. There are no pointers being used here. > --001a1133769056575204e93035f1 > Content-Type: text/html; charset=UTF-8 > Content-Transfer-Encoding: quoted-printable Can you please stop posting HTML? Thanks! Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de The human race is faced with a cruel choice: work or daytime tele- vision. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot