Xi Wang 6d92d4f6a7 fs/exec.c: work around icc miscompilation
The tricky problem is this check:

	if (i++ >= max)

icc (mis)optimizes this check as:

	if (++i > max)

The check now becomes a no-op since max is MAX_ARG_STRINGS (0x7FFFFFFF).

This is "allowed" by the C standard, assuming i++ never overflows,
because signed integer overflow is undefined behavior.  This
optimization effectively reverts the previous commit 362e6663ef23
("exec.c, compat.c: fix count(), compat_count() bounds checking") that
tries to fix the check.

This patch simply moves ++ after the check.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-01-11 14:54:55 -08:00
..
2012-12-20 14:00:01 -05:00
2012-12-20 14:00:01 -05:00
2012-12-20 14:00:01 -05:00
2012-11-16 11:20:42 -06:00
2013-01-03 11:41:43 -08:00
2012-12-20 17:40:20 -08:00
2012-12-20 14:00:01 -05:00
2012-12-20 18:40:00 -05:00
2012-12-20 18:40:52 -05:00
2012-12-20 18:40:53 -05:00
2012-12-20 18:40:53 -05:00
2012-12-20 18:40:54 -05:00
2012-12-20 18:40:54 -05:00
2012-12-20 18:40:55 -05:00
2012-12-20 14:00:01 -05:00
2012-12-20 14:00:01 -05:00
2013-01-03 15:57:14 -08:00
2012-07-14 16:34:47 +04:00
2012-12-20 14:00:01 -05:00
2012-12-20 14:00:01 -05:00
2012-12-17 17:15:26 -08:00
2012-12-20 14:00:01 -05:00
2012-10-22 08:50:37 +03:00
2012-10-29 09:00:57 -07:00
2012-10-09 15:52:31 +09:00
2013-01-03 15:57:16 -08:00
2012-11-28 21:49:02 -05:00
2012-12-20 18:46:29 -05:00
2012-10-09 18:35:22 -04:00
2012-12-11 13:43:42 +09:00
2012-09-26 21:08:52 -04:00
2012-12-17 17:15:27 -08:00
2013-01-06 20:58:13 -08:00
2012-12-20 18:50:01 -05:00
2012-10-09 23:33:39 -04:00