Module Name: src Committed By: mrg Date: Mon Aug 7 23:27:07 UTC 2023
Modified Files: src/sbin/resize_lfs: resize_lfs.c Log Message: fix potentially uninitialised data being used. found by GCC 12. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sbin/resize_lfs/resize_lfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/resize_lfs/resize_lfs.c diff -u src/sbin/resize_lfs/resize_lfs.c:1.15 src/sbin/resize_lfs/resize_lfs.c:1.16 --- src/sbin/resize_lfs/resize_lfs.c:1.15 Thu Aug 22 20:26:07 2019 +++ src/sbin/resize_lfs/resize_lfs.c Mon Aug 7 23:27:07 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: resize_lfs.c,v 1.15 2019/08/22 20:26:07 brad Exp $ */ +/* $NetBSD: resize_lfs.c,v 1.16 2023/08/07 23:27:07 mrg Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. * All rights reserved. @@ -124,7 +124,7 @@ main(int argc, char **argv) err(1, "open filesystem root"); /* Read the superblock, finding alternates if necessary */ - fs = (struct lfs *)malloc(sizeof(*fs)); + fs = (struct lfs *)calloc(sizeof(*fs), 1); for (sboff = LFS_LABELPAD;;) { pread(devfd, buf, sboff, LFS_SBPAD); __CTASSERT(sizeof(struct dlfs) == sizeof(struct dlfs64));