]> git.baikalelectronics.ru Git - kernel.git/commit
introduce SIZE_MAX
authorXi Wang <xi.wang@gmail.com>
Thu, 31 May 2012 23:26:04 +0000 (16:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 1 Jun 2012 00:49:26 +0000 (17:49 -0700)
commit96b8f8b105a4a2b8a053d67f7b49ea853625a4db
tree48d688c6c391ef45f79bdd60815450ca06c5cc1a
parentc94dbfe5613539c9a21a2737885f65c996ceaa3a
introduce SIZE_MAX

ULONG_MAX is often used to check for integer overflow when calculating
allocation size.  While ULONG_MAX happens to work on most systems, there
is no guarantee that `size_t' must be the same size as `long'.

This patch introduces SIZE_MAX, the maximum value of `size_t', to improve
portability and readability for allocation size validation.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Acked-by: Alex Elder <elder@dreamhost.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ceph/snap.c
include/drm/drm_mem_util.h
include/linux/kernel.h
include/linux/slab.h