Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/ufs/ffs Pull up following revision(s) (requested by r...
details: https://anonhg.NetBSD.org/src/rev/518c25421fae
branches: netbsd-7
changeset: 799608:518c25421fae
user: riz <riz%NetBSD.org@localhost>
date: Wed Nov 04 14:56:32 2015 +0000
description:
Pull up following revision(s) (requested by riastradh in ticket #896):
sys/ufs/ffs/ffs_bswap.c: revision 1.38
sys/ufs/ffs/ffs_bswap.c: revision 1.39
Don't (harmlessly) overrun di_db array; copy di_ib separately.
Noted by Coverity, CID 974635.
While here, simplify size calculation for memcpy.
memcpy di_extb/db/ib separately. Noted by Coverity, CID 974636.
diffstat:
sys/ufs/ffs/ffs_bswap.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (39 lines):
diff -r 6b6882afd5c4 -r 518c25421fae sys/ufs/ffs/ffs_bswap.c
--- a/sys/ufs/ffs/ffs_bswap.c Sat Oct 31 22:03:58 2015 +0000
+++ b/sys/ufs/ffs/ffs_bswap.c Wed Nov 04 14:56:32 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_bswap.c,v 1.37 2013/06/09 17:55:46 dholland Exp $ */
+/* $NetBSD: ffs_bswap.c,v 1.37.8.1 2015/11/04 14:56:32 riz Exp $ */
/*
* Copyright (c) 1998 Manuel Bouyer.
@@ -30,7 +30,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_bswap.c,v 1.37 2013/06/09 17:55:46 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_bswap.c,v 1.37.8.1 2015/11/04 14:56:32 riz Exp $");
#include <sys/param.h>
#if defined(_KERNEL)
@@ -128,7 +128,8 @@
n->di_mtimensec = bswap32(o->di_mtimensec);
n->di_ctime = bswap32(o->di_ctime);
n->di_ctimensec = bswap32(o->di_ctimensec);
- memcpy(n->di_db, o->di_db, (UFS_NDADDR + UFS_NIADDR) * sizeof(u_int32_t));
+ memcpy(n->di_db, o->di_db, sizeof(n->di_db));
+ memcpy(n->di_ib, o->di_ib, sizeof(n->di_ib));
n->di_flags = bswap32(o->di_flags);
n->di_blocks = bswap32(o->di_blocks);
n->di_gen = bswap32(o->di_gen);
@@ -158,7 +159,9 @@
n->di_kernflags = bswap32(o->di_kernflags);
n->di_flags = bswap32(o->di_flags);
n->di_extsize = bswap32(o->di_extsize);
- memcpy(n->di_extb, o->di_extb, (UFS_NXADDR + UFS_NDADDR + UFS_NIADDR) * 8);
+ memcpy(n->di_extb, o->di_extb, sizeof(n->di_extb));
+ memcpy(n->di_db, o->di_db, sizeof(n->di_db));
+ memcpy(n->di_ib, o->di_ib, sizeof(n->di_ib));
}
void
Home |
Main Index |
Thread Index |
Old Index