Page MenuHomeFreeBSD

cam: Let cam_periph_unmapmem() return an error
ClosedPublic

Authored by markj on Dec 26 2023, 11:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 14, 1:33 AM
Unknown Object (File)
Tue, Oct 14, 1:32 AM
Unknown Object (File)
Tue, Oct 14, 1:32 AM
Unknown Object (File)
Mon, Oct 13, 11:59 AM
Unknown Object (File)
Sun, Oct 5, 10:34 AM
Unknown Object (File)
Sep 20 2025, 2:54 PM
Unknown Object (File)
Sep 15 2025, 12:17 PM
Unknown Object (File)
Sep 15 2025, 5:18 AM
Subscribers

Details

Summary

As of commit b059686a71c8, cam_periph_unmapmem() can legitimately fail,
if the copyout() operation fails. However, this failure is never
signaled to upper layers. In practice it is unlikely to occur since
cap_periph_mapmem() would most likely fail in such circumstances anyway.

However, some code reading revealed a few paths where the return value
of cam_periph_mapmem() is not checked, and this is definitely a bug.
Add error checking there and let cam_periph_unmapmem() return errors
from copyout().

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 55129
Build 52018: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Dec 28 2023, 3:52 PM
mav added inline comments.
sys/cam/scsi/scsi_target.c
914–917

These printf's are weird to see, but I don't know anybody still using this code, so whatever.

sys/cam/scsi/scsi_target.c
914–917

Indeed, I just copied it for consistency with the printf below.

This revision was automatically updated to reflect the committed changes.