public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cryptocop: Fix assertion in create_output_descriptors()
@ 2009-10-12 12:56 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-10-12 12:56 UTC (permalink / raw)
  To: Mikael Starvik, Jesper Nilsson, linux-cris-kernel, Andrew Morton,
	LKML

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index fd529a0..b70fb34 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -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);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-12 12:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-12 12:56 [PATCH] cryptocop: Fix assertion in create_output_descriptors() Roel Kluin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox