Page MenuHomeFreeBSD

hwpmc: don't use deprecated copystr(9)
ClosedPublic

Authored by mhorne on May 1 2023, 7:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 19, 9:47 PM
Unknown Object (File)
Fri, Dec 12, 8:27 PM
Unknown Object (File)
Fri, Dec 12, 7:58 AM
Unknown Object (File)
Nov 24 2025, 4:49 AM
Unknown Object (File)
Nov 19 2025, 7:00 PM
Unknown Object (File)
Nov 9 2025, 1:15 AM
Unknown Object (File)
Nov 8 2025, 10:29 AM
Unknown Object (File)
Oct 31 2025, 6:41 AM

Details

Summary

It is just wrapper around strlcpy(), but results in more complicated
code. Clean this up to use strlcpy() or snprintf() as appropriate.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mhorne requested review of this revision.May 1 2023, 7:39 PM
jkoshy requested changes to this revision.May 2 2023, 7:42 AM
jkoshy added inline comments.
sys/dev/hwpmc/hwpmc_amd.c
919

How about using sizeof(pi->pm_name) instead of PMC_NAME_MAX?

This would remove the need for the reader to check that the pm_name field is at least PMC_NAME_MAX in size.

Here and below.

This revision now requires changes to proceed.May 2 2023, 7:42 AM
mhorne marked an inline comment as done.

Use sizeof(pi->pm_name).

This revision is now accepted and ready to land.May 2 2023, 5:58 PM
This revision was automatically updated to reflect the committed changes.