From 899813de92338beee6adcb59f49e46259c727e6d Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Thu, 22 May 2014 10:44:17 +1000 Subject: [PATCH] ipc,shm: document new limits in the uapi header This is useful in the future and allows users to better understand the reasoning behind the changes. Also use UL as we're dealing with it anyways. Signed-off-by: Davidlohr Bueso Cc: Michael Kerrisk Cc: Manfred Spraul Signed-off-by: Andrew Morton --- include/uapi/linux/shm.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/uapi/linux/shm.h b/include/uapi/linux/shm.h index 74e786de6f4e..e37fb08df9cd 100644 --- a/include/uapi/linux/shm.h +++ b/include/uapi/linux/shm.h @@ -8,17 +8,19 @@ #endif /* - * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can - * be modified by sysctl. + * SHMMNI, SHMMAX and SHMALL are the default upper limits which can be + * modified by sysctl. Both SHMMAX and SHMALL have their default values + * to the maximum limit which is as large as it can be without helping + * userspace overflow the values. There is really nothing the kernel + * can do to avoid this any variables. It is therefore not advised to + * make them any larger. This is suitable for both 32 and 64-bit systems. */ - #define SHMMIN 1 /* min shared seg size (bytes) */ #define SHMMNI 4096 /* max num of segs system wide */ -#define SHMMAX (ULONG_MAX - (1L<<24)) /* max shared seg size (bytes) */ -#define SHMALL (ULONG_MAX - (1L<<24)) /* max shm system wide (pages) */ +#define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */ +#define SHMALL (ULONG_MAX - (1UL << 24)) /* max shm system wide (pages) */ #define SHMSEG SHMMNI /* max shared segs per process */ - /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct shmid_ds { struct ipc_perm shm_perm; /* operation perms */ -- 2.39.5