mirror of
https://github.com/opnsense/src.git
synced 2026-04-21 22:27:47 -04:00
Actually check to see if XPT_CALC_GEOMETRY had an error
and pick a bogus geometry if it had so we don't later get a divide by zero trap.
This commit is contained in:
parent
5b9fdd582c
commit
9dcfabf816
1 changed files with 17 additions and 3 deletions
|
|
@ -1865,9 +1865,23 @@ dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector)
|
|||
ccg.secs_per_track = 0;
|
||||
ccg.cylinders = 0;
|
||||
xpt_action((union ccb*)&ccg);
|
||||
dp->heads = ccg.heads;
|
||||
dp->secs_per_track = ccg.secs_per_track;
|
||||
dp->cylinders = ccg.cylinders;
|
||||
if ((ccg.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
|
||||
/*
|
||||
* We don't know what went wrong here- but just pick
|
||||
* a geometry so we don't have nasty things like divide
|
||||
* by zero.
|
||||
*/
|
||||
dp->heads = 255;
|
||||
dp->secs_per_track = 255;
|
||||
dp->cylinders = dp->sectors / (255 * 255);
|
||||
if (dp->cylinders == 0) {
|
||||
dp->cylinders = 1;
|
||||
}
|
||||
} else {
|
||||
dp->heads = ccg.heads;
|
||||
dp->secs_per_track = ccg.secs_per_track;
|
||||
dp->cylinders = ccg.cylinders;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Reference in a new issue