Module Name: src
Committed By: mrg
Date: Fri Aug 11 05:51:34 UTC 2023
Modified Files:
src/sys/fs/hfs: libhfs.c
Log Message:
avoid uninitialised variable usage in early error paths.
found by GCC 12.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/hfs/libhfs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/hfs/libhfs.c
diff -u src/sys/fs/hfs/libhfs.c:1.18 src/sys/fs/hfs/libhfs.c:1.19
--- src/sys/fs/hfs/libhfs.c:1.18 Mon Jun 19 08:40:30 2023
+++ src/sys/fs/hfs/libhfs.c Fri Aug 11 05:51:34 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: libhfs.c,v 1.18 2023/06/19 08:40:30 msaitoh Exp $ */
+/* $NetBSD: libhfs.c,v 1.19 2023/08/11 05:51:34 mrg 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.18 2023/06/19 08:40:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.19 2023/08/11 05:51:34 mrg Exp $");
#include "libhfs.h"
@@ -545,7 +545,7 @@ hfslib_find_catalog_record_with_key(
hfs_catalog_keyed_record_t* out_rec,
hfs_callback_args* cbargs)
{
- hfs_node_descriptor_t nd;
+ hfs_node_descriptor_t nd = { .num_recs = 0 };
hfs_extent_descriptor_t* extents;
hfs_catalog_keyed_record_t lastrec;
hfs_catalog_key_t* curkey;
@@ -585,7 +585,6 @@ hfslib_find_catalog_record_with_key(
if (numextents == 0)
HFS_LIBERR("could not locate fork extents");
- nd.num_recs = 0;
curnode = in_vol->chr.root_node;
#ifdef DLO_DEBUG
@@ -687,7 +686,7 @@ hfslib_find_extent_record_with_key(hfs_v
hfs_extent_record_t* out_rec,
hfs_callback_args* cbargs)
{
- hfs_node_descriptor_t nd;
+ hfs_node_descriptor_t nd = { .num_recs = 0 };
hfs_extent_descriptor_t* extents;
hfs_extent_record_t lastrec;
hfs_extent_key_t curkey;
@@ -922,7 +921,7 @@ hfslib_get_directory_contents(
uint32_t* out_numchildren,
hfs_callback_args* cbargs)
{
- hfs_node_descriptor_t nd;
+ hfs_node_descriptor_t nd = { .num_recs = 0 };
hfs_extent_descriptor_t* extents;
hfs_catalog_keyed_record_t currec;
hfs_catalog_key_t curkey;