Module Name:    src
Committed By:   jakllsch
Date:           Wed Oct  3 23:32:43 UTC 2012

Modified Files:
        src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
We don't actually want to round the number of elements in the bitmap
down.  Fixes a self-inflicted buffer overrun.

(This was detected by chance that the top of the bitmap coincided with
a page boundary.)


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/fs/msdosfs/msdosfs_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/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.96 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.97
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.96	Sat Jul  7 16:18:50 2012
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Wed Oct  3 23:32:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.96 2012/07/07 16:18:50 tsutsui Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.97 2012/10/03 23:32:43 jakllsch Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.96 2012/07/07 16:18:50 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.97 2012/10/03 23:32:43 jakllsch Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -771,7 +771,7 @@ msdosfs_mountfs(struct vnode *devvp, str
 	 * Allocate memory for the bitmap of allocated clusters, and then
 	 * fill it in.
 	 */
-	pmp->pm_inusemap = malloc(((pmp->pm_maxcluster + N_INUSEBITS - 1)
+	pmp->pm_inusemap = malloc(((pmp->pm_maxcluster + N_INUSEBITS)
 				   / N_INUSEBITS)
 				  * sizeof(*pmp->pm_inusemap),
 				  M_MSDOSFSFAT, M_WAITOK);

Reply via email to