git: 51281d53e784 - stable/13 - Make SHMMAXPGS an unsigned long
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 04 Apr 2022 11:06:10 UTC
The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=51281d53e7849b0adde114e12e91d10c190f3149 commit 51281d53e7849b0adde114e12e91d10c190f3149 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2022-03-15 17:42:30 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2022-04-04 09:37:07 +0000 Make SHMMAXPGS an unsigned long This is used to calculate sizes that are then stored in unsigned long fields. Make this unsigned long so the calculations use this type and not an int that can lead to an integer overflow with a large PAGE_SIZE. This allows building this on arm64 with PAGE_SIZE of 16k. Further work will be needed if a 32-bit architecture tries to use a similar sized page. Sponsored by: The FreeBSD Foundation (cherry picked from commit cab496e16cb384de03010d9dea7399cbbfb3c3f9) --- sys/kern/sysv_shm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 2e7ae927dcc3..e1d6fda7e2a3 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -155,7 +155,7 @@ static void shm_prison_cleanup(struct prison *); * Tuneable values. */ #ifndef SHMMAXPGS -#define SHMMAXPGS 131072 /* Note: sysv shared memory is swap backed. */ +#define SHMMAXPGS 131072ul /* Note: sysv shared memory is swap backed. */ #endif #ifndef SHMMAX #define SHMMAX (SHMMAXPGS*PAGE_SIZE)