Message ID | 20170306153705.32381-1-dmitry.ereminsolenikov@linaro.org |
---|---|
State | New |
Headers | show |
> -----Original Message----- > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of > Dmitry Eremin-Solenikov > Sent: Monday, March 06, 2017 5:37 PM > To: lng-odp@lists.linaro.org > Subject: [lng-odp] [PATCH] linux-generic: crypto: properly handle errors > in packet copy > > Add proper handling for errors returned by odp_packet_copy_from_pkt(). > > Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> > --- > odp_packet_len(param->pkt)); > + if (odp_unlikely(odp_packet_copy_from_pkt(param- > >out_pkt, > + > 0, > + > param->pkt, > + > 0, > + > odp_packet_len(param->pkt)) < 0)) { > + ODP_DBG("Copy failed.\n"); > + return -1; > + } > _odp_packet_copy_md_to_packet(param->pkt, param- > >out_pkt); > odp_packet_free(param->pkt); > param->pkt = ODP_PACKET_INVALID; Did you run checkpatch on this patch. It should warn you about over 80 char lines. perl scripts/checkpatch.pl <patch> To avoid long line do e.g. ret = odp_packet_copy_from_pkt(); if(ret) ... -Petri
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 54b222fd..d7440c81 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -886,11 +886,14 @@ odp_crypto_operation(odp_crypto_op_param_t *param, } if (param->pkt != param->out_pkt) { - (void)odp_packet_copy_from_pkt(param->out_pkt, - 0, - param->pkt, - 0, - odp_packet_len(param->pkt)); + if (odp_unlikely(odp_packet_copy_from_pkt(param->out_pkt, + 0, + param->pkt, + 0, + odp_packet_len(param->pkt)) < 0)) { + ODP_DBG("Copy failed.\n"); + return -1; + } _odp_packet_copy_md_to_packet(param->pkt, param->out_pkt); odp_packet_free(param->pkt); param->pkt = ODP_PACKET_INVALID;
Add proper handling for errors returned by odp_packet_copy_from_pkt(). Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> --- platform/linux-generic/odp_crypto.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.11.0