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)
Sun, May 19, 8:41 PM
Unknown Object (File)
Thu, May 9, 2:39 PM
Unknown Object (File)
Thu, May 9, 10:43 AM
Unknown Object (File)
Thu, May 9, 4:08 AM
Unknown Object (File)
Mon, May 6, 5:47 PM
Unknown Object (File)
Sun, May 5, 1:15 AM
Unknown Object (File)
Wed, May 1, 1:52 AM
Unknown Object (File)
Wed, May 1, 1:51 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.