diff mbox series

compress/isal: fixes offset check

Message ID 1533035316-63812-1-git-send-email-lee.daly@intel.com (mailing list archive)
State Superseded, archived
Headers show
Series compress/isal: fixes offset check | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Daly, Lee July 31, 2018, 11:08 a.m. UTC
This commit fixes an offset check in decompression which was checking
destination offset size against dst data_len rather than checking
against dst pkt_len as required.

Fixes:788e748d3845 ("compress/isal: support chained mbufs")

Signed-off-by: Lee Daly <lee.daly@intel.com>
---
 drivers/compress/isal/isal_compress_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pablo de Lara Aug. 1, 2018, 8:10 a.m. UTC | #1
Hi Lee,

> -----Original Message-----
> From: Daly, Lee
> Sent: Tuesday, July 31, 2018 12:09 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; Daly, Lee <lee.daly@intel.com>
> Subject: [PATCH] compress/isal: fixes offset check
> 
> This commit fixes an offset check in decompression which was checking
> destination offset size against dst data_len rather than checking against dst
> pkt_len as required.
> 
> Fixes:788e748d3845 ("compress/isal: support chained mbufs")
> 
> Signed-off-by: Lee Daly <lee.daly@intel.com>
> ---
>  drivers/compress/isal/isal_compress_pmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/compress/isal/isal_compress_pmd.c
> b/drivers/compress/isal/isal_compress_pmd.c
> index e75f48d..aef56e3 100644
> --- a/drivers/compress/isal/isal_compress_pmd.c
> +++ b/drivers/compress/isal/isal_compress_pmd.c
> @@ -483,7 +483,7 @@ process_isal_inflate(struct rte_comp_op *op, struct
> isal_comp_qp *qp)
>  		return -1;
>  	}
> 
> -	if (op->dst.offset > op->m_dst->data_len) {
> +	if (op->dst.offset > op->m_dst->pkt_len) {

Actually, I think you should check if offset is higher or EQUAL to pktlen (>=).
This applies to the isal_deflate function too.
 
>  		ISAL_PMD_LOG(ERR, "Output mbuf not big enough for length
> and "
>  				"offset provided.\n");

I think message should say that mbuf is not big enough for the offset provided,
as length is not passed like in the input mbufs.

>  		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
> --
> 2.7.4

Thanks,
Pablo
diff mbox series

Patch

diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index e75f48d..aef56e3 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -483,7 +483,7 @@  process_isal_inflate(struct rte_comp_op *op, struct isal_comp_qp *qp)
 		return -1;
 	}
 
-	if (op->dst.offset > op->m_dst->data_len) {
+	if (op->dst.offset > op->m_dst->pkt_len) {
 		ISAL_PMD_LOG(ERR, "Output mbuf not big enough for length and "
 				"offset provided.\n");
 		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;