DF-1338 / fix.diff
diff --git a/sys/dev/disk/sili/sili.c b/sys/dev/disk/sili/sili.c --- a/sys/dev/disk/sili/sili.c +++ b/sys/dev/disk/sili/sili.c @@ -1243,6 +1243,8 @@ int sgi; KKASSERT(nsegs <= SILI_MAX_SGET); + if (nsegs > SILI_MAX_SGET) + nsegs = SILI_MAX_SGET; sgi = 0; sge = &ccb->ccb_prb->prb_sge[0]; @@ -2137,6 +2139,8 @@ */ err_slot = log->err_regs.type & ATA_LOG_10H_TYPE_TAG_MASK; + if (err_slot < 0 || err_slot >= SILI_MAX_CMDS) + err_slot = 0; ccb = &ap->ap_ccbs[err_slot]; if (ap->ap_expired & (1 << ccb->ccb_slot)) { kprintf("%s: read NCQ error page slot=%d\n", |