On 2/10/23 18:58, Nicolas Chautru wrote:
Adding handling of negative scenario for malformed
Transport Block mode operations.

Fixes: bec597b78a0 ("baseband/acc200: add LTE processing")

The format is invalid, the sha-1 should be 12B long, checkpatch
complains about it:

WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: bec597b78a0e ("baseband/acc200: add LTE processing")'
#9:
Fixes: bec597b78a0 ("baseband/acc200: add LTE processing")


I will fix it here and in other patches.
To avoid such issues, you can add an alias in your git global config
file (e.g. ~/.gitconfig):

[alias]
        fixline = log -1 --abbrev=12 --format='Fixes: %h (\"%s\")%nCc: %ae'

With this, to generate a Fixes tag, you just have to do:

$ git fixline bec597b78a0e347f7a82a0d51e4a9fc61dea0a16
Fixes: bec597b78a0e ("baseband/acc200: add LTE processing")
Cc: nicolas.chau...@intel.com

Hernan, this issue is also present in "baseband/acc: fix check after
deref and dead code", I will also fix it while applying, but please
consider adding the git alias.

Thanks,
Maxime

Cc: sta...@dpdk.org

Signed-off-by: Nicolas Chautru <nicolas.chau...@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coque...@redhat.com>
---
  drivers/baseband/acc/rte_vrb_pmd.c | 20 ++++++++++++++++++++
  1 file changed, 20 insertions(+)

diff --git a/drivers/baseband/acc/rte_vrb_pmd.c 
b/drivers/baseband/acc/rte_vrb_pmd.c
index 34e42d1f6e..3afaea71a3 100644
--- a/drivers/baseband/acc/rte_vrb_pmd.c
+++ b/drivers/baseband/acc/rte_vrb_pmd.c
@@ -1820,6 +1820,9 @@ enqueue_enc_one_op_tb(struct acc_queue *q, struct 
rte_bbdev_enc_op *op,
        r = op->turbo_enc.tb_params.r;
while (mbuf_total_left > 0 && r < c) {
+               if (unlikely((input == NULL) || (output == NULL)))
+                       return -1;
+
                seg_total_left = rte_pktmbuf_data_len(input) - in_offset;
                /* Set up DMA descriptor */
                desc = acc_desc(q, total_enqueued_cbs);
@@ -1854,6 +1857,10 @@ enqueue_enc_one_op_tb(struct acc_queue *q, struct 
rte_bbdev_enc_op *op,
                r++;
        }
+ /* In case the number of CB doesn't match, the configuration was invalid. */
+       if (unlikely(current_enqueued_cbs != cbs_in_tb))
+               return -1;
+
        /* Set SDone on last CB descriptor for TB mode. */
        desc->req.sdone_enable = 1;
@@ -2100,6 +2107,9 @@ vrb_enqueue_ldpc_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op,
        }
while (mbuf_total_left > 0 && r < c) {
+               if (unlikely((input == NULL) || (h_output == NULL)))
+                       return -1;
+
                if (check_bit(op->ldpc_dec.op_flags, 
RTE_BBDEV_LDPC_DEC_SCATTER_GATHER))
                        seg_total_left = rte_pktmbuf_data_len(input) - 
in_offset;
                else
@@ -2145,6 +2155,10 @@ vrb_enqueue_ldpc_dec_one_op_tb(struct acc_queue *q, 
struct rte_bbdev_dec_op *op,
                r++;
        }
+ /* In case the number of CB doesn't match, the configuration was invalid. */
+       if (unlikely(current_enqueued_cbs != cbs_in_tb))
+               return -1;
+
  #ifdef RTE_LIBRTE_BBDEV_DEBUG
        if (check_mbuf_total_left(mbuf_total_left) != 0)
                return -EINVAL;
@@ -2187,6 +2201,8 @@ enqueue_dec_one_op_tb(struct acc_queue *q, struct 
rte_bbdev_dec_op *op,
        r = op->turbo_dec.tb_params.r;
while (mbuf_total_left > 0 && r < c) {
+               if (unlikely((input == NULL) || (h_output == NULL)))
+                       return -1;
seg_total_left = rte_pktmbuf_data_len(input) - in_offset; @@ -2237,6 +2253,10 @@ enqueue_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op,
                r++;
        }
+ /* In case the number of CB doesn't match, the configuration was invalid. */
+       if (unlikely(current_enqueued_cbs != cbs_in_tb))
+               return -1;
+
        /* Set SDone on last CB descriptor for TB mode */
        desc->req.sdone_enable = 1;

Reply via email to