Page MenuHomeFreeBSD

libpmc: Use known pmc_cpuid buffer size
ClosedPublic

Authored by freqlabs on Jul 15 2020, 5:21 PM.
Tags
None
Referenced Files
F132001258: D25679.diff
Sun, Oct 12, 8:36 PM
Unknown Object (File)
Sat, Sep 20, 11:03 PM
Unknown Object (File)
Sep 10 2025, 2:15 PM
Unknown Object (File)
Sep 9 2025, 3:41 PM
Unknown Object (File)
Aug 30 2025, 6:27 AM
Unknown Object (File)
Aug 14 2025, 10:54 PM
Unknown Object (File)
Jul 1 2025, 4:04 AM
Unknown Object (File)
Jun 24 2025, 4:09 PM
Subscribers

Details

Summary

Use the existing PMC_CPUID_LEN to size pmc_cpuid in the kernel and various buffers for reading it in libpmc.
This avoids some extra syscalls and malloc/frees.

While in here, use strlcpy to copy a user-provided cpuid string instead of memcpy, to make sure we terminate the buffer.

Sorry for the extra review noise mav, this ended up changing a bit after taking a final look at the original patch :)

Diff Detail

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

Event Timeline

Going to commit this tonight since there has been no objection

With kernel part I am definitely agree, while about first part of user space just won't object. While second part of user-space just had no sense before, the first one at least had some sense, even though not willing much.

This revision is now accepted and ready to land.Jul 28 2020, 1:21 AM
This revision was automatically updated to reflect the committed changes.