Skip to contentSkip to conversation

cryptocop: Fix assertion in create_output_descriptors()

PATCH New Roel Kluin 1 participant 1 message Oct 12, 2009

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 cryptocop: Fix assertion in create_output_descriptors()

size_t desc_len cannot be less than 0, test before the subtraction.

---

arch/cris/arch-v32/drivers/cryptocop.c +1 -1
index fd529a0..b70fb34 100644
@@ -628,9 +628,9 @@ static int create_output_descriptors(struct cryptocop_operation *operation, int
 		cdesc->dma_descr->buf = (char*)virt_to_phys(operation->tfrm_op.indata[*iniov_ix].iov_base + *iniov_offset);
 		cdesc->dma_descr->after = cdesc->dma_descr->buf + dlength;
 
+		assert(desc_len >= dlength);
 		desc_len -= dlength;
 		*iniov_offset += dlength;
-		assert(desc_len >= 0);
 		if (*iniov_offset >= operation->tfrm_op.indata[*iniov_ix].iov_len) {
 			*iniov_offset = 0;
 			++(*iniov_ix);