Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ffs Fix a "slight tweak" from Rev. 1.121: bap1/bap2...
details: https://anonhg.NetBSD.org/src/rev/e49c73aacccf
branches: trunk
changeset: 818986:e49c73aacccf
user: hannken <hannken%NetBSD.org@localhost>
date: Fri Nov 11 10:50:16 2016 +0000
description:
Fix a "slight tweak" from Rev. 1.121: bap1/bap2 must be valid
before using BAP_ASSIGN().
Prevents NULL pointer dereference when "lastbn >= 0".
diffstat:
sys/ufs/ffs/ffs_inode.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diffs (41 lines):
diff -r 4add9f8bee85 -r e49c73aacccf sys/ufs/ffs/ffs_inode.c
--- a/sys/ufs/ffs/ffs_inode.c Fri Nov 11 10:40:00 2016 +0000
+++ b/sys/ufs/ffs/ffs_inode.c Fri Nov 11 10:50:16 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_inode.c,v 1.122 2016/11/10 20:56:32 jdolecek Exp $ */
+/* $NetBSD: ffs_inode.c,v 1.123 2016/11/11 10:50:16 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.122 2016/11/10 20:56:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.123 2016/11/11 10:50:16 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -659,6 +659,10 @@
* This assumes the truncate process would not fail, contrary
* to the wapbl case.
*/
+ if (ip->i_ump->um_fstype == UFS1)
+ bap1 = (int32_t *)bp->b_data;
+ else
+ bap2 = (int64_t *)bp->b_data;
if (lastbn >= 0 && !wapbl) {
copy = kmem_alloc(fs->fs_bsize, KM_SLEEP);
memcpy((void *)copy, bp->b_data, (u_int)fs->fs_bsize);
@@ -672,11 +676,6 @@
bap1 = (int32_t *)copy;
else
bap2 = (int64_t *)copy;
- } else {
- if (ip->i_ump->um_fstype == UFS1)
- bap1 = (int32_t *)bp->b_data;
- else
- bap2 = (int64_t *)bp->b_data;
}
/*
Home |
Main Index |
Thread Index |
Old Index