Sun Mar 8 17:38:12 2020 UTC ()
Perform bit operations on unsigned integer

ext2fs_vnops.c:1002:2, signed integer overflow: 510008 * 4294 cannot be represented in type 'int

Maximum usec * 4294 is in the range of unsigned int.

>>> 1000000*4294
4294000000
>>> 2**32
4294967296

Patch submitted by Nisarg S. Joshi.


(kamil)
diff -r1.130 -r1.131 src/sys/ufs/ext2fs/ext2fs_vnops.c

cvs diff -r1.130 -r1.131 src/sys/ufs/ext2fs/ext2fs_vnops.c (expand / switch to context diff)
--- src/sys/ufs/ext2fs/ext2fs_vnops.c 2019/09/18 17:59:15 1.130
+++ src/sys/ufs/ext2fs/ext2fs_vnops.c 2020/03/08 17:38:12 1.131
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_vnops.c,v 1.130 2019/09/18 17:59:15 christos Exp $	*/
+/*	$NetBSD: ext2fs_vnops.c,v 1.131 2020/03/08 17:38:12 kamil Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.130 2019/09/18 17:59:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.131 2020/03/08 17:38:12 kamil Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -999,7 +999,7 @@
 	 */
 	getmicrouptime(&tv);
 	SETHIGH(ip->i_modrev, tv.tv_sec);
-	SETLOW(ip->i_modrev, tv.tv_usec * 4294);
+	SETLOW(ip->i_modrev, tv.tv_usec * 4294U);
 	*vpp = vp;
 	return 0;
 }