* [PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero [not found] <20230523184818.139353-1-hernan.vargas@intel.com> @ 2023-05-23 18:48 ` Hernan Vargas 2023-05-23 19:26 ` Maxime Coquelin 2023-05-23 18:48 ` [PATCH v1 2/6] baseband/fpga_5gnr_fec: fix seg fault unconf queue Hernan Vargas 1 sibling, 1 reply; 4+ messages in thread From: Hernan Vargas @ 2023-05-23 18:48 UTC (permalink / raw) To: dev, maxime.coquelin, gakhil, trix Cc: nicolas.chautru, qi.z.zhang, Hernan Vargas, stable 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero 2023-05-23 18:48 ` [PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero Hernan Vargas @ 2023-05-23 19:26 ` Maxime Coquelin 0 siblings, 0 replies; 4+ messages in thread From: Maxime Coquelin @ 2023-05-23 19:26 UTC (permalink / raw) To: Hernan Vargas, dev, gakhil, trix; +Cc: nicolas.chautru, qi.z.zhang, stable On 5/23/23 20:48, Hernan Vargas wrote: > 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; You could take the opportunity to move n declaration at the top of the function. We this done, feel free to add: Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Thanks, Maxime > if (n_cb == n) { > if (rv_index == 1) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 2/6] baseband/fpga_5gnr_fec: fix seg fault unconf queue [not found] <20230523184818.139353-1-hernan.vargas@intel.com> 2023-05-23 18:48 ` [PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero Hernan Vargas @ 2023-05-23 18:48 ` Hernan Vargas 2023-05-23 19:28 ` Maxime Coquelin 1 sibling, 1 reply; 4+ messages in thread From: Hernan Vargas @ 2023-05-23 18:48 UTC (permalink / raw) To: dev, maxime.coquelin, gakhil, trix Cc: nicolas.chautru, qi.z.zhang, Hernan Vargas, stable Adding exception to prevent segmentation fault in case a queue is started which was not configured earlier. Fixes: c58109a8871d ("baseband/fpga_5gnr_fec: add queue configuration") Cc: stable@dpdk.org Signed-off-by: Hernan Vargas <hernan.vargas@intel.com> --- drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 4 ++++ 1 file changed, 4 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 9388cce52960..a6211f73e6e3 100644 --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c @@ -573,6 +573,10 @@ fpga_queue_start(struct rte_bbdev *dev, uint16_t queue_id) return -1; } #endif + if (dev->data->queues[queue_id].queue_private == NULL) { + rte_bbdev_log(ERR, "Cannot start invalid queue %d", queue_id); + return -1; + } struct fpga_queue *q = dev->data->queues[queue_id].queue_private; uint32_t offset = FPGA_5GNR_FEC_RING_CTRL_REGS + (sizeof(struct fpga_ring_ctrl_reg) * q->q_idx); -- 2.37.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 2/6] baseband/fpga_5gnr_fec: fix seg fault unconf queue 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 0 siblings, 0 replies; 4+ messages in thread From: Maxime Coquelin @ 2023-05-23 19:28 UTC (permalink / raw) To: Hernan Vargas, dev, gakhil, trix; +Cc: nicolas.chautru, qi.z.zhang, stable On 5/23/23 20:48, Hernan Vargas wrote: > Adding exception to prevent segmentation fault in case a queue is > started which was not configured earlier. > > Fixes: c58109a8871d ("baseband/fpga_5gnr_fec: add queue configuration") > Cc: stable@dpdk.org > > Signed-off-by: Hernan Vargas <hernan.vargas@intel.com> > --- > drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 4 ++++ > 1 file changed, 4 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 9388cce52960..a6211f73e6e3 100644 > --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c > +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c > @@ -573,6 +573,10 @@ fpga_queue_start(struct rte_bbdev *dev, uint16_t queue_id) > return -1; > } > #endif > + if (dev->data->queues[queue_id].queue_private == NULL) { > + rte_bbdev_log(ERR, "Cannot start invalid queue %d", queue_id); > + return -1; > + } > struct fpga_queue *q = dev->data->queues[queue_id].queue_private; > uint32_t offset = FPGA_5GNR_FEC_RING_CTRL_REGS + > (sizeof(struct fpga_ring_ctrl_reg) * q->q_idx); Same comment here for offset and q declarations, it should be at the top of the function. Maxime ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-23 19:28 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20230523184818.139353-1-hernan.vargas@intel.com> 2023-05-23 18:48 ` [PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero Hernan Vargas 2023-05-23 19:26 ` 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
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).