Module Name:    src
Committed By:   kamil
Date:           Fri Feb 28 11:27:38 UTC 2020

Modified Files:
        src/sys/fs/hfs: hfs_vfsops.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/fs/hfs/hfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/hfs/hfs_vfsops.c
diff -u src/sys/fs/hfs/hfs_vfsops.c:1.36 src/sys/fs/hfs/hfs_vfsops.c:1.37
--- src/sys/fs/hfs/hfs_vfsops.c:1.36	Fri Jan 17 20:08:07 2020
+++ src/sys/fs/hfs/hfs_vfsops.c	Fri Feb 28 11:27:38 2020
@@ -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 @@ hfs_statvfs(struct mount *mp, struct sta
 	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;

Reply via email to