Page MenuHomeFreeBSD

memstat_kvm_uma: fix reading of uma_zone_domain structures
ClosedPublic

Authored by vangyzen on Aug 27 2020, 3:14 PM.
Tags
None
Referenced Files
F161322840: D26213.id76284.diff
Thu, Jul 2, 7:41 PM
F161321629: D26213.id76321.diff
Thu, Jul 2, 7:24 PM
Unknown Object (File)
Thu, Jul 2, 10:06 AM
Unknown Object (File)
Thu, Jul 2, 7:00 AM
Unknown Object (File)
Wed, Jun 24, 7:35 AM
Unknown Object (File)
Tue, Jun 9, 8:42 PM
Unknown Object (File)
Jun 2 2026, 6:20 PM
Unknown Object (File)
Jun 2 2026, 4:27 PM
Subscribers

Details

Summary

Coverity flagged the scaling by sizeof(uzd). That is the type
of the pointer, so the scaling was already done by pointer arithmetic.
However, this was also passing a stack frame pointer to kvm_read,
so it was doubly wrong.

Move ZDOM_GET into the !_KERNEL section and use it in libmemstat.

Reported by: Coverity

Test Plan

I ran this against a vmcore file and it still printed some garbage
stats, but the printf I added for debugging no longer complained.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj added inline comments.
sys/vm/uma_int.h
531 ↗(On Diff #76284)

Fix the indent to be consistent while you're here?

This revision is now accepted and ready to land.Aug 27 2020, 3:39 PM