Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ffs Check for bread errors before we do the size che...
details: https://anonhg.NetBSD.org/src/rev/c5b736181780
branches: trunk
changeset: 328354:c5b736181780
user: christos <christos%NetBSD.org@localhost>
date: Tue Apr 01 14:28:17 2014 +0000
description:
Check for bread errors before we do the size check. Otherwise we de-reference
NULL...
diffstat:
sys/ufs/ffs/ffs_vfsops.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (37 lines):
diff -r 7fc4bfecf28a -r c5b736181780 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c Tue Apr 01 14:09:14 2014 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c Tue Apr 01 14:28:17 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_vfsops.c,v 1.295 2014/03/23 15:21:16 hannken Exp $ */
+/* $NetBSD: ffs_vfsops.c,v 1.296 2014/04/01 14:28:17 christos Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.295 2014/03/23 15:21:16 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.296 2014/04/01 14:28:17 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -1125,14 +1125,14 @@
*/
if (!ronly) {
- error = bread(devvp, FFS_FSBTODB(fs, fs->fs_size - 1), fs->fs_fsize,
- cred, 0, &bp);
- if (bp->b_bcount != fs->fs_fsize)
- error = EINVAL;
+ error = bread(devvp, FFS_FSBTODB(fs, fs->fs_size - 1),
+ fs->fs_fsize, cred, 0, &bp);
if (error) {
bset = BC_INVAL;
goto out;
}
+ if (bp->b_bcount != fs->fs_fsize)
+ error = EINVAL;
brelse(bp, BC_INVAL);
bp = NULL;
}
Home |
Main Index |
Thread Index |
Old Index