mirror of
https://github.com/opnsense/src.git
synced 2026-06-12 18:20:49 -04:00
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. MFC after: 2 weeks
This commit is contained in:
parent
ad8d336799
commit
5aedb8b1d4
2 changed files with 2 additions and 4 deletions
|
|
@ -1572,9 +1572,7 @@ sdda_add_part(struct cam_periph *periph, u_int type, const char *name,
|
|||
part->disk->d_gone = sddadiskgonecb;
|
||||
part->disk->d_name = part->name;
|
||||
part->disk->d_drv1 = part;
|
||||
part->disk->d_maxsize =
|
||||
MIN(maxphys, sdda_get_max_data(periph,
|
||||
(union ccb *)&cpi) * mmc_get_sector_size(periph));
|
||||
part->disk->d_maxsize = MIN(maxphys, cpi.maxio);
|
||||
part->disk->d_unit = cnt;
|
||||
part->disk->d_flags = 0;
|
||||
strlcpy(part->disk->d_descr, sc->card_id_string,
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ mmc_cam_sim_default_action(struct cam_sim *sim, union ccb *ccb)
|
|||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
} else {
|
||||
mmc_path_inq(&ccb->cpi, "Deglitch Networks",
|
||||
sim, mmc.host_max_data);
|
||||
sim, mmc.host_max_data * MMC_SECTOR_SIZE);
|
||||
}
|
||||
break;
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
|
|
|
|||
Loading…
Reference in a new issue