mps: If we don't have enough space for a sge and chain, don't claim we can
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 7 Feb 2012 09:35:20 +0000 (17:35 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 7 Feb 2012 09:35:20 +0000 (17:35 +0800)
sys/dev/raid/mps/mps.c

index 155e142..4861c39 100644 (file)
@@ -1887,6 +1887,7 @@ mps_push_sge(struct mps_command *cm, void *sgep, size_t len, int segsleft)
                panic("MPS: Need SGE Error Code\n");
 
        if (segsleft >= 2 &&
+           cm->cm_sglsize >= len + MPS_SGC_SIZE &&
            cm->cm_sglsize < len + MPS_SGC_SIZE + MPS_SGE64_SIZE) {
                /*
                 * There are 2 or more segments left to add, and only