Module Name: src
Committed By: rin
Date: Sun May 31 08:38:54 UTC 2020
Modified Files:
src/sys/miscfs/procfs: procfs_linux.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/miscfs/procfs/procfs_linux.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/miscfs/procfs/procfs_linux.c
diff -u src/sys/miscfs/procfs/procfs_linux.c:1.83 src/sys/miscfs/procfs/procfs_linux.c:1.84
--- src/sys/miscfs/procfs/procfs_linux.c:1.83 Sat May 23 23:42:43 2020
+++ src/sys/miscfs/procfs/procfs_linux.c Sun May 31 08:38:54 2020
@@ -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 @@ procfs_domounts(struct lwp *curl, struct
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,