Page MenuHomeFreeBSD

CID 1332000: Logically dead code in sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
ClosedPublic

Authored by dab on Feb 12 2019, 6:21 PM.

Details

Summary

A pointer is first tested for NULL. If non-NULL, another pointer is set equal to the first. The second pointer is then checked for NULL and an error path taken if so. This second test and the associated path is dead code as the pointer value, having just been checked for NULL, cannot be NULL at this point. Remove the dead code.

Test Plan

Code inspection

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dab created this revision.Feb 12 2019, 6:21 PM

Looks good to me. I would not be shocked if there are plenty of similar cases elsewhere in the driver.

We should also strongly consider addressing the additional change added at $WORK while we're in this function. I can send you the details, but there was a fairly bad issue in this ioctl path where if ESGL bit in the request isn't initialized the card may end up basically doing a DMA to host memory unexpectedly. Whether we combine that or do a separate review is fine, but that's one of the more... concerning, and discrete fixes (and easily testable by calling the ioctl) that we have that could use upstreaming.

This revision is now accepted and ready to land.Feb 22 2019, 5:01 PM
vangyzen accepted this revision.Feb 22 2019, 5:11 PM
This revision was automatically updated to reflect the committed changes.