Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/hfs Avoid undefined behavior in left shift semantics



details:   https://anonhg.NetBSD.org/src/rev/3f23f38dbff7
branches:  trunk
changeset: 745318:3f23f38dbff7
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Feb 28 11:27:38 2020 +0000

description:
Avoid undefined behavior in left shift semantics

hfs_vfsops.c:477:19, left shift of 1 by 31 places cannot be represented in type 'int'

diffstat:

 sys/fs/hfs/hfs_vfsops.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 4e1ff9853053 -r 3f23f38dbff7 sys/fs/hfs/hfs_vfsops.c
--- a/sys/fs/hfs/hfs_vfsops.c   Fri Feb 28 10:59:58 2020 +0000
+++ b/sys/fs/hfs/hfs_vfsops.c   Fri Feb 28 11:27:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hfs_vfsops.c,v 1.36 2020/01/17 20:08:07 ad Exp $       */
+/*     $NetBSD: hfs_vfsops.c,v 1.37 2020/02/28 11:27:38 kamil Exp $    */
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.36 2020/01/17 20:08:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.37 2020/02/28 11:27:38 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -474,7 +474,7 @@
        sbp->f_bavail = vh->free_blocks; /* blocks free for non superuser */
        sbp->f_bresvd = 0;
        sbp->f_files =  vh->file_count; /* total files */
-       sbp->f_ffree = (1<<31) - vh->file_count; /* free file nodes */
+       sbp->f_ffree = (1U<<31) - vh->file_count; /* free file nodes */
        copy_statvfs_info(sbp, mp);
 
        return 0;



Home | Main Index | Thread Index | Old Index