DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hernan Vargas <hernan.vargas@intel.com>
To: dev@dpdk.org, maxime.coquelin@redhat.com, gakhil@marvell.com,
	trix@redhat.com
Cc: nicolas.chautru@intel.com, qi.z.zhang@intel.com,
	Hernan Vargas <hernan.vargas@intel.com>,
	stable@dpdk.org
Subject: [PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero
Date: Tue, 23 May 2023 11:48:13 -0700	[thread overview]
Message-ID: <20230523184818.139353-2-hernan.vargas@intel.com> (raw)
In-Reply-To: <20230523184818.139353-1-hernan.vargas@intel.com>

Add fix to have an early exit when z_c is zero to prevent a possible
division by zero.

Fixes: 44dc6faa796f ("baseband/fpga_5gnr_fec: add LDPC processing functions")
Cc: stable@dpdk.org

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index f29565af8cca..9388cce52960 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -879,6 +879,8 @@ get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index)
 {
 	if (rv_index == 0)
 		return 0;
+	if (z_c == 0)
+		return 0;
 	uint16_t n = (bg == 1 ? N_ZC_1 : N_ZC_2) * z_c;
 	if (n_cb == n) {
 		if (rv_index == 1)
-- 
2.37.1


  reply	other threads:[~2023-05-23 18:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 18:48 [PATCH v1 0/6] baseband/fpga_5gnr_fec: changes for 23.07 Hernan Vargas
2023-05-23 18:48 ` Hernan Vargas [this message]
2023-05-23 19:26   ` [PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero Maxime Coquelin
2023-05-23 18:48 ` [PATCH v1 2/6] baseband/fpga_5gnr_fec: fix seg fault unconf queue Hernan Vargas
2023-05-23 19:28   ` Maxime Coquelin
2023-05-23 18:48 ` [PATCH v1 3/6] baseband/fpga_5gnr_fec: renaming for consistency Hernan Vargas
2023-05-23 18:48 ` [PATCH v1 4/6] baseband/fpga_5gnr_fec: add Vista Creek variant Hernan Vargas
2023-05-23 18:48 ` [PATCH v1 5/6] baseband/fpga_5gnr_fec: add AGX100 support Hernan Vargas
2023-05-23 18:48 ` [PATCH v1 6/6] baseband/fpga_5gnr_fec: cosmetic comment changes Hernan Vargas
2023-05-23 19:20 ` [PATCH v1 0/6] baseband/fpga_5gnr_fec: changes for 23.07 Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230523184818.139353-2-hernan.vargas@intel.com \
    --to=hernan.vargas@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nicolas.chautru@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).