summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2000-08-12 21:08:42 +0000
committerbde <bde@FreeBSD.org>2000-08-12 21:08:42 +0000
commit73dafc9420a520f8a7e279eb6a854c6acacf661d (patch)
tree479a9d9be788d0fa36710d7cf2694ad4f2232c5d /sys/compat
parentba51ed6068846f911c7d4d26c659eba074c55c2d (diff)
downloadFreeBSD-src-73dafc9420a520f8a7e279eb6a854c6acacf661d.zip
FreeBSD-src-73dafc9420a520f8a7e279eb6a854c6acacf661d.tar.gz
Fixed null pointer panic for accessing "meminfo" when there is no swap.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linprocfs/linprocfs.c9
-rw-r--r--sys/compat/linprocfs/linprocfs_misc.c9
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index 4babe74..5d78083 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -99,8 +99,13 @@ linprocfs_domeminfo(curp, p, pfs, uio)
*/
memused = cnt.v_wire_count * PAGE_SIZE;
memfree = memtotal - memused;
- swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
- swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ if (swapblist == NULL) {
+ swaptotal = 0;
+ swapfree = 0;
+ } else {
+ swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
+ swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ }
swapused = swaptotal - swapfree;
memshared = 0;
for (object = TAILQ_FIRST(&vm_object_list); object != NULL;
diff --git a/sys/compat/linprocfs/linprocfs_misc.c b/sys/compat/linprocfs/linprocfs_misc.c
index 4babe74..5d78083 100644
--- a/sys/compat/linprocfs/linprocfs_misc.c
+++ b/sys/compat/linprocfs/linprocfs_misc.c
@@ -99,8 +99,13 @@ linprocfs_domeminfo(curp, p, pfs, uio)
*/
memused = cnt.v_wire_count * PAGE_SIZE;
memfree = memtotal - memused;
- swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
- swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ if (swapblist == NULL) {
+ swaptotal = 0;
+ swapfree = 0;
+ } else {
+ swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
+ swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ }
swapused = swaptotal - swapfree;
memshared = 0;
for (object = TAILQ_FIRST(&vm_object_list); object != NULL;
OpenPOWER on IntegriCloud