Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Aug 2019 22:24:50 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r508689 - in head/games: openbor openbor/files openbor3482 openbor3482/files openbor3711 openbor3979 openbor3979/files openbor4432 openbor4432/files
Message-ID:  <201908112224.x7BMOorQ026943@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Sun Aug 11 22:24:49 2019
New Revision: 508689
URL: https://svnweb.freebsd.org/changeset/ports/508689

Log:
  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

Modified:
  head/games/openbor/Makefile   (contents, props changed)
  head/games/openbor/files/patch-source_ramlib_ram.c   (contents, props changed)
  head/games/openbor3482/Makefile   (contents, props changed)
  head/games/openbor3482/files/patch-source_ramlib_ram.c   (contents, props changed)
  head/games/openbor3711/Makefile   (contents, props changed)
  head/games/openbor3979/Makefile   (contents, props changed)
  head/games/openbor3979/files/patch-source_ramlib_ram.c   (contents, props changed)
  head/games/openbor4432/Makefile   (contents, props changed)
  head/games/openbor4432/files/patch-source_ramlib_ram.c   (contents, props changed)

Modified: head/games/openbor/Makefile
==============================================================================
--- head/games/openbor/Makefile	Sun Aug 11 22:15:14 2019	(r508688)
+++ head/games/openbor/Makefile	Sun Aug 11 22:24:49 2019	(r508689)
@@ -4,7 +4,7 @@ PORTNAME=	openbor
 # Hint: svn revision is git rev-list --count ${GH_TAGNAME}
 PORTVERSION?=	7068
 .ifndef PKGNAMESUFFIX
-PORTREVISION=	0
+PORTREVISION=	1
 .endif
 CATEGORIES=	games
 

Modified: head/games/openbor/files/patch-source_ramlib_ram.c
==============================================================================
--- head/games/openbor/files/patch-source_ramlib_ram.c	Sun Aug 11 22:15:14 2019	(r508688)
+++ head/games/openbor/files/patch-source_ramlib_ram.c	Sun Aug 11 22:24:49 2019	(r508689)
@@ -59,8 +59,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);
@@ -70,8 +70,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
@@ -92,8 +92,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);

Modified: head/games/openbor3482/Makefile
==============================================================================
--- head/games/openbor3482/Makefile	Sun Aug 11 22:15:14 2019	(r508688)
+++ head/games/openbor3482/Makefile	Sun Aug 11 22:24:49 2019	(r508689)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTVERSION=	3482
-PORTREVISION=	1
+PORTREVISION=	2
 PKGNAMESUFFIX=	${PORTVERSION}
 
 MASTERDIR=	${.CURDIR}/../openbor

Modified: head/games/openbor3482/files/patch-source_ramlib_ram.c
==============================================================================
--- head/games/openbor3482/files/patch-source_ramlib_ram.c	Sun Aug 11 22:15:14 2019	(r508688)
+++ head/games/openbor3482/files/patch-source_ramlib_ram.c	Sun Aug 11 22:24:49 2019	(r508689)
@@ -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);

Modified: head/games/openbor3711/Makefile
==============================================================================
--- head/games/openbor3711/Makefile	Sun Aug 11 22:15:14 2019	(r508688)
+++ head/games/openbor3711/Makefile	Sun Aug 11 22:24:49 2019	(r508689)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTVERSION=	3711
-PORTREVISION=	1
+PORTREVISION=	2
 PKGNAMESUFFIX=	${PORTVERSION}
 
 MASTERDIR=	${.CURDIR}/../openbor

Modified: head/games/openbor3979/Makefile
==============================================================================
--- head/games/openbor3979/Makefile	Sun Aug 11 22:15:14 2019	(r508688)
+++ head/games/openbor3979/Makefile	Sun Aug 11 22:24:49 2019	(r508689)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTVERSION=	3979
-PORTREVISION=	1
+PORTREVISION=	2
 PKGNAMESUFFIX=	${PORTVERSION}
 
 MASTERDIR=	${.CURDIR}/../openbor

Modified: head/games/openbor3979/files/patch-source_ramlib_ram.c
==============================================================================
--- head/games/openbor3979/files/patch-source_ramlib_ram.c	Sun Aug 11 22:15:14 2019	(r508688)
+++ head/games/openbor3979/files/patch-source_ramlib_ram.c	Sun Aug 11 22:24:49 2019	(r508689)
@@ -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);

Modified: head/games/openbor4432/Makefile
==============================================================================
--- head/games/openbor4432/Makefile	Sun Aug 11 22:15:14 2019	(r508688)
+++ head/games/openbor4432/Makefile	Sun Aug 11 22:24:49 2019	(r508689)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTVERSION=	4432
-PORTREVISION=	2
+PORTREVISION=	3
 PKGNAMESUFFIX=	${PORTVERSION}
 
 MASTERDIR=	${.CURDIR}/../openbor

Modified: head/games/openbor4432/files/patch-source_ramlib_ram.c
==============================================================================
--- head/games/openbor4432/files/patch-source_ramlib_ram.c	Sun Aug 11 22:15:14 2019	(r508688)
+++ head/games/openbor4432/files/patch-source_ramlib_ram.c	Sun Aug 11 22:24:49 2019	(r508689)
@@ -59,8 +59,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);
@@ -70,8 +70,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
@@ -92,8 +92,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908112224.x7BMOorQ026943>