Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ext2fs Perform bit operations on unsigned integer



details:   https://anonhg.NetBSD.org/src/rev/396550213432
branches:  trunk
changeset: 745669:396550213432
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sun Mar 08 17:38:12 2020 +0000

description:
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.

diffstat:

 sys/ufs/ext2fs/ext2fs_vnops.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r b45ba408e152 -r 396550213432 sys/ufs/ext2fs/ext2fs_vnops.c
--- a/sys/ufs/ext2fs/ext2fs_vnops.c     Sun Mar 08 17:23:55 2020 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c     Sun Mar 08 17:38:12 2020 +0000
@@ -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;
 }



Home | Main Index | Thread Index | Old Index