HomeFreeBSD

mmc_da: fix garbage in disk->d_attachment

Description

mmc_da: fix garbage in disk->d_attachment

The garbage resulted from reading the value from a ccb which was
originally populated by XPT_PATH_INQ operation but then overwritten by
XPT_GET_TRAN_SETTINGS operation.

The problem could probably be fixed by re-ordering the
XPT_GET_TRAN_SETTINGS operation, but it seems like the operation was
redundant. Besides, the ccb is declared not as union ccb but as struct
ccb_pathinq, so using it for XPT_GET_TRAN_SETTINGS was questionable.

I opted for replacing a call to sdda_get_max_data (which uses
XPT_GET_TRAN_SETTINGS internally) with using maxio provided by the
XPT_PATH_INQ operation.

This also required fixing mmc_cam_sim_default_action as controllers
return maximum I/O size in sectors, but maxio value should be in bytes.

(cherry picked from commit 5aedb8b1d4a6c099eaa0a65f8fcbdcc4aba8f75b)

Details

Provenance
avgAuthored on Jun 23 2025, 9:43 PM
Parents
rGb91babab9596: mmc_xpt: use strlcpy instead of strncpy
Branches
Unknown
Tags
Unknown