Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/hfs Assert that out_hr is not NULL in hfslib_read_hea...
details: https://anonhg.NetBSD.org/src/rev/30a37983bccb
branches: trunk
changeset: 779750:30a37983bccb
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Jun 15 21:59:39 2012 +0000
description:
Assert that out_hr is not NULL in hfslib_read_header_node
diffstat:
sys/fs/hfs/libhfs.c | 52 +++++++++++++++++++++++++---------------------------
1 files changed, 25 insertions(+), 27 deletions(-)
diffs (76 lines):
diff -r aca68c09d52d -r 30a37983bccb sys/fs/hfs/libhfs.c
--- a/sys/fs/hfs/libhfs.c Fri Jun 15 19:54:21 2012 +0000
+++ b/sys/fs/hfs/libhfs.c Fri Jun 15 21:59:39 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: libhfs.c,v 1.10 2011/02/24 23:49:26 christos Exp $ */
+/* $NetBSD: libhfs.c,v 1.11 2012/06/15 21:59:39 joerg Exp $ */
/*-
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.10 2011/02/24 23:49:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.11 2012/06/15 21:59:39 joerg Exp $");
#include "libhfs.h"
@@ -1658,34 +1658,32 @@
{
void* ptr;
int i;
-
+
+ KASSERT(out_hr != NULL);
+
if(in_recs==NULL || in_rec_sizes==NULL)
return 0;
- if(out_hr!=NULL)
- {
- ptr = in_recs[0];
-
- out_hr->tree_depth = be16tohp(&ptr);
- out_hr->root_node = be32tohp(&ptr);
- out_hr->leaf_recs = be32tohp(&ptr);
- out_hr->first_leaf = be32tohp(&ptr);
- out_hr->last_leaf = be32tohp(&ptr);
- out_hr->node_size = be16tohp(&ptr);
- out_hr->max_key_len = be16tohp(&ptr);
- out_hr->total_nodes = be32tohp(&ptr);
- out_hr->free_nodes = be32tohp(&ptr);
- out_hr->reserved = be16tohp(&ptr);
- out_hr->clump_size = be32tohp(&ptr);
- out_hr->btree_type = *(((uint8_t*)ptr));
- ptr = (uint8_t*)ptr + 1;
- out_hr->keycomp_type = *(((uint8_t*)ptr));
- ptr = (uint8_t*)ptr + 1;
- out_hr->attributes = be32tohp(&ptr);
- for(i=0;i<16;i++)
- out_hr->reserved2[i] = be32tohp(&ptr);
- }
-
+ ptr = in_recs[0];
+ out_hr->tree_depth = be16tohp(&ptr);
+ out_hr->root_node = be32tohp(&ptr);
+ out_hr->leaf_recs = be32tohp(&ptr);
+ out_hr->first_leaf = be32tohp(&ptr);
+ out_hr->last_leaf = be32tohp(&ptr);
+ out_hr->node_size = be16tohp(&ptr);
+ out_hr->max_key_len = be16tohp(&ptr);
+ out_hr->total_nodes = be32tohp(&ptr);
+ out_hr->free_nodes = be32tohp(&ptr);
+ out_hr->reserved = be16tohp(&ptr);
+ out_hr->clump_size = be32tohp(&ptr);
+ out_hr->btree_type = *(((uint8_t*)ptr));
+ ptr = (uint8_t*)ptr + 1;
+ out_hr->keycomp_type = *(((uint8_t*)ptr));
+ ptr = (uint8_t*)ptr + 1;
+ out_hr->attributes = be32tohp(&ptr);
+ for(i=0;i<16;i++)
+ out_hr->reserved2[i] = be32tohp(&ptr);
+
if(out_userdata!=NULL)
{
memcpy(out_userdata, in_recs[1], in_rec_sizes[1]);
Home |
Main Index |
Thread Index |
Old Index