Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cda1c5af authored by Roel Kluin's avatar Roel Kluin Committed by Linus Torvalds
Browse files

cryptocop: fix assertion in create_output_descriptors()



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

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ba875ba6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);