Page MenuHomeFreeBSD

linuxkpi: Add `strtomem()` and `strtomem_pad()`
ClosedPublic

Authored by dumbbell on Mar 8 2026, 1:17 PM.
Tags
None
Referenced Files
F173978695: D55729.id174998.diff
Tue, Sep 29, 6:24 PM
F173962531: D55729.id174982.diff
Tue, Sep 29, 4:18 PM
F173962525: D55729.id173380.diff
Tue, Sep 29, 4:18 PM
F173951696: D55729.diff
Tue, Sep 29, 2:43 PM
Unknown Object (File)
Tue, Sep 29, 1:04 AM
Unknown Object (File)
Thu, Sep 17, 6:59 AM
Unknown Object (File)
Wed, Sep 16, 6:20 AM
Unknown Object (File)
Fri, Sep 11, 3:06 AM
Subscribers

Details

Summary

The DRM generic code started to use strtomem_pad() in Linux 6.11.

This is part of the update of DRM drivers to Linux 6.11.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/compat/linuxkpi/common/include/linux/string.h
311

what is this 4-arg memcpy?

Fix use of memcpy() as reported by @emaste

dumbbell added inline comments.
sys/compat/linuxkpi/common/include/linux/string.h
311

Too much copy-paste

bz requested changes to this revision.Mar 29 2026, 11:29 PM
bz added a subscriber: bz.
bz added inline comments.
sys/compat/linuxkpi/common/include/linux/string.h
307

Reading the description it sounds like (here and down) dest should use ARRAY_SIZE (nitems)?

This revision now requires changes to proceed.Mar 29 2026, 11:29 PM
sys/compat/linuxkpi/common/include/linux/string.h
307

So you suggest:

size_t dstlen = ARRAY_SIZE(dst);
``` instead, is that correct?

I’m not sure i get the difference. Is it semantically more correct?

In this case, should `ARRAY_SIZE()` be used for `srclen` too?
sys/compat/linuxkpi/common/include/linux/string.h
307

Only for dstlen as dst that is supposed to be a Pointer of destination character array (marked as __nonstring) according to the documentation. Making in ARRAY_SIZE I hope will catch other possible kinds of buffers--while Linux should catch that already for drivers I would hope, in case we use this internally in LinuxKPI it's just to be saver.

Use ARRAY_SIZE() as suggested by @bz.

This revision is now accepted and ready to land.Apr 6 2026, 5:04 PM