From 46098a9d0923033bb7fa4caa14ce5e1576bb2bb7 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 20 Dec 2008 22:52:06 +0100 Subject: [PATCH] Fix a dereference of an undefined value. ntmp was being accessed (via ntfs_bntodoff()) before it was allocated. The whole thing only worked because BBLOCK is 0 and the dereference was optimized away (though not with -O0). Found-by: LLVM/Clang Static Analyzer --- sys/vfs/ntfs/ntfs_vfsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/vfs/ntfs/ntfs_vfsops.c b/sys/vfs/ntfs/ntfs_vfsops.c index e0408655a3..a62d8849f3 100644 --- a/sys/vfs/ntfs/ntfs_vfsops.c +++ b/sys/vfs/ntfs/ntfs_vfsops.c @@ -433,7 +433,7 @@ ntfs_mountfs(struct vnode *devvp, struct mount *mp, struct ntfs_args *argsp, bp = NULL; - error = bread(devvp, ntfs_bntodoff(BBLOCK), BBSIZE, &bp); + error = bread(devvp, 0, BBSIZE, &bp); if (error) goto out; ntmp = kmalloc(sizeof *ntmp, M_NTFSMNT, M_WAITOK | M_ZERO); -- 2.11.4.GIT