diff options
author | Jan Beich <jbeich@FreeBSD.org> | 2019-08-11 22:24:49 +0000 |
---|---|---|
committer | Jan Beich <jbeich@FreeBSD.org> | 2019-08-11 22:24:49 +0000 |
commit | 21ab7fe69dfcc10ca05c10052156869cd80e5c55 (patch) | |
tree | ccb003aa4b990d81a0a209a0d800ae13df9cd591 /games/openbor3979 | |
parent | ce5a6de0c93364b250956e6da6bad102366a6082 (diff) |
games/openbor: fix free memory stats
source/ramlib/ram.c:137:18: runtime error: unsigned integer overflow: 9420649 * 4096 cannot be represented in type 'unsigned int'
Reported by: -fsanitize=integer
Notes
Notes:
svn path=/head/; revision=508689
Diffstat (limited to 'games/openbor3979')
-rw-r--r-- | games/openbor3979/Makefile | 2 | ||||
-rw-r--r-- | games/openbor3979/files/patch-source_ramlib_ram.c | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/games/openbor3979/Makefile b/games/openbor3979/Makefile index 058e6d7c0024..a5237b6f81b4 100644 --- a/games/openbor3979/Makefile +++ b/games/openbor3979/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTVERSION= 3979 -PORTREVISION= 1 +PORTREVISION= 2 PKGNAMESUFFIX= ${PORTVERSION} MASTERDIR= ${.CURDIR}/../openbor diff --git a/games/openbor3979/files/patch-source_ramlib_ram.c b/games/openbor3979/files/patch-source_ramlib_ram.c index 9485b7bd1906..eb06b6b133b7 100644 --- a/games/openbor3979/files/patch-source_ramlib_ram.c +++ b/games/openbor3979/files/patch-source_ramlib_ram.c @@ -82,8 +82,8 @@ Implement Linux-like memory stats for BSDs + { + return 0; + } -+ return (u64)((vms.v_free_count + vms.v_inactive_count -+ + vms.v_cache_count) * getpagesize()) / byte_size; ++ return (u64)(vms.v_free_count + vms.v_inactive_count ++ + vms.v_cache_count) * getpagesize() / byte_size; +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + u_int v_free_count = 0, v_inactive_count = 0, v_cache_count = 0; + size_t sz = sizeof(u_int); @@ -93,8 +93,8 @@ Implement Linux-like memory stats for BSDs + &v_inactive_count, &sz, NULL, 0); + sysctlbyname("vm.stats.vm.v_cache_count", + &v_cache_count, &sz, NULL, 0); -+ return (u64)((v_free_count + v_inactive_count + v_cache_count) -+ * getpagesize()) / byte_size; ++ return (u64)(v_free_count + v_inactive_count ++ + v_cache_count) * getpagesize() / byte_size; +#elif defined(__NetBSD__) || defined(__OpenBSD__) +# if defined(__NetBSD__) +#undef VM_UVMEXP @@ -115,8 +115,8 @@ Implement Linux-like memory stats for BSDs + { + return 0; + } -+ return (u64)((uvmexp.free + uvmexp.inactive + uvmexp.filepages -+ + uvmexp.execpages) * uvmexp.pagesize) / byte_size; ++ return (u64)(uvmexp.free + uvmexp.inactive + uvmexp.filepages ++ + uvmexp.execpages) * uvmexp.pagesize / byte_size; #elif LINUX struct sysinfo info; sysinfo(&info); |