[PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero

Hernan Vargas hernan.vargas at intel.com
Tue May 23 20:48:13 CEST 2023


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 at dpdk.org

Signed-off-by: Hernan Vargas <hernan.vargas at 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



More information about the stable mailing list