Page MenuHomeFreeBSD

linuxkpi: add strncpy_from_user()
Needs ReviewPublic

Authored by denis.borovikov_gmail.com on Thu, Oct 1, 4:14 PM.
Tags
None
Referenced Files
F174900690: D60198.id188694.diff
Tue, Oct 6, 8:52 PM
F174831510: D60198.diff
Tue, Oct 6, 7:52 AM
Unknown Object (File)
Mon, Oct 5, 10:52 PM
Unknown Object (File)
Mon, Oct 5, 10:23 PM
Unknown Object (File)
Mon, Oct 5, 2:19 PM
Unknown Object (File)
Mon, Oct 5, 5:44 AM
Unknown Object (File)
Mon, Oct 5, 5:02 AM
Unknown Object (File)
Mon, Oct 5, 1:52 AM

Details

Reviewers
wulf
manu
Summary

Same semantics as Linux: returns the string length without the NUL, count if the string was truncated, or -EFAULT. Implemented with copyinstr(9). Unlike linux_copyin() it does not translate the remapped ioctl argument window; its user, drm/virtio, passes a pointer taken from the ioctl payload, so that is not needed.

Test Plan

Built on main with this applied: linuxkpi, linuxkpi_wlan, mlx5, iwlwifi and ath10k for aarch64 and amd64, and drm-kmod's virtio-gpu (freebsd/drm-kmod#517) without its interim copy of this function.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

wulf added inline comments.
sys/compat/linuxkpi/common/include/linux/uaccess.h
38

#include <sys/systm.h> should immediately follow #include <sys/param.h>. See man 9 style

This revision is now accepted and ready to land.Sun, Oct 4, 5:23 PM
This revision now requires review to proceed.Mon, Oct 5, 5:19 AM
denis.borovikov_gmail.com added inline comments.
sys/compat/linuxkpi/common/include/linux/uaccess.h
38

done

denis.borovikov_gmail.com edited the test plan for this revision. (Show Details)

<sys/systm.h> now follows <sys/param.h>, as wulf asked; nothing else.