Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/procfs struct statvfs is too large for stack. Use...
details: https://anonhg.NetBSD.org/src/rev/e8590bbe2ce4
branches: trunk
changeset: 972603:e8590bbe2ce4
user: rin <rin%NetBSD.org@localhost>
date: Sun May 31 08:38:54 2020 +0000
description:
struct statvfs is too large for stack. Use malloc(9) instead.
XXX
Switch to kmem(9) for entire this file.
Frame size, e.g. for m68k, becomes:
3292 --> 12
diffstat:
sys/miscfs/procfs/procfs_linux.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diffs (42 lines):
diff -r bd4ad7c234f9 -r e8590bbe2ce4 sys/miscfs/procfs/procfs_linux.c
--- a/sys/miscfs/procfs/procfs_linux.c Sun May 31 08:33:47 2020 +0000
+++ b/sys/miscfs/procfs/procfs_linux.c Sun May 31 08:38:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_linux.c,v 1.83 2020/05/23 23:42:43 ad Exp $ */
+/* $NetBSD: procfs_linux.c,v 1.84 2020/05/31 08:38:54 rin Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.83 2020/05/23 23:42:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.84 2020/05/31 08:38:54 rin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -611,18 +611,19 @@
struct mount *mp;
int error = 0, root = 0;
struct cwdinfo *cwdi = curl->l_proc->p_cwdi;
+ struct statvfs *sfs;
bf = malloc(LBFSZ, M_TEMP, M_WAITOK);
+ sfs = malloc(sizeof(*sfs), M_TEMP, M_WAITOK);
mountlist_iterator_init(&iter);
while ((mp = mountlist_iterator_next(iter)) != NULL) {
- struct statvfs sfs;
-
- if ((error = dostatvfs(mp, &sfs, curl, MNT_WAIT, 0)) == 0)
+ if ((error = dostatvfs(mp, sfs, curl, MNT_WAIT, 0)) == 0)
root |= procfs_format_sfs(&mtab, &mtabsz, bf, LBFSZ,
- &sfs, curl, 0);
+ sfs, curl, 0);
}
mountlist_iterator_destroy(iter);
+ free(sfs, M_TEMP);
/*
* If we are inside a chroot that is not itself a mount point,
Home |
Main Index |
Thread Index |
Old Index