Page MenuHomeFreeBSD

devfs readdir: handle short buffer same as UFS
ClosedPublic

Authored by kib on Aug 1 2025, 12:31 PM.
Tags
None
Referenced Files
F131079217: D51667.id159540.diff
Sat, Oct 4, 8:41 PM
Unknown Object (File)
Fri, Oct 3, 2:36 PM
Unknown Object (File)
Mon, Sep 29, 6:58 AM
Unknown Object (File)
Sun, Sep 28, 5:12 PM
Unknown Object (File)
Sat, Sep 27, 12:21 AM
Unknown Object (File)
Wed, Sep 24, 1:12 AM
Unknown Object (File)
Tue, Sep 16, 7:53 AM
Unknown Object (File)
Sep 5 2025, 12:22 AM
Subscribers

Details

Summary
Return EINVAL if this is the first dirent encountered with the short
buffer, or EJUSTRETURN if something was already copied out.

This is needed to pass eof check in vop_readdir_post(): we are not at
eof but resid was not advanced.

Reported and tested by:    pho

Diff Detail

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

Event Timeline

kib requested review of this revision.Aug 1 2025, 12:31 PM
sys/fs/devfs/devfs_vnops.c
1503

Why not just return 0 in this case? At least one dirent was successfully copied.

Simply stop if buffer is too small and something was copied out.

kib marked an inline comment as done.Aug 1 2025, 4:40 PM
This revision is now accepted and ready to land.Aug 1 2025, 4:45 PM
This revision was automatically updated to reflect the committed changes.