Hi David, With some nits below, Acked-by: Dmitry Kozlyuk <dmitry.kozl...@gmail.com>
2021-10-24 22:04 (UTC+0200), David Marchand: > From: Harman Kalra <hka...@marvell.com> > > Dynamically allocating the efds and elist array os intr_handle Typo: "os" -> "of" > structure, based on size provided by user. Eg size can be > MSIX interrupts supported by a PCI device. > > Signed-off-by: Harman Kalra <hka...@marvell.com> > Signed-off-by: David Marchand <david.march...@redhat.com> > --- > Changes since v5: > - split from patch5, > > --- [...] > diff --git a/lib/eal/common/eal_common_interrupts.c > b/lib/eal/common/eal_common_interrupts.c > index 3285c4335f..7feb9da8fa 100644 > --- a/lib/eal/common/eal_common_interrupts.c > +++ b/lib/eal/common/eal_common_interrupts.c [...] > int rte_intr_fd_set(struct rte_intr_handle *intr_handle, int fd) > @@ -239,6 +330,12 @@ int rte_intr_efds_index_get(const struct rte_intr_handle > *intr_handle, > { > CHECK_VALID_INTR_HANDLE(intr_handle); > > + if (intr_handle->efds == NULL) { > + RTE_LOG(ERR, EAL, "Event fd list not allocated\n"); > + rte_errno = EFAULT; > + goto fail; > + } > + Here and below: The check for `nb_intr` will already catch not allocated `efds`, because `nb_intr` is necessarily 0 in this case. > if (index >= intr_handle->nb_intr) { > RTE_LOG(ERR, EAL, "Invalid index %d, max limit %d\n", index, > intr_handle->nb_intr); > @@ -256,6 +353,12 @@ int rte_intr_efds_index_set(struct rte_intr_handle > *intr_handle, > { > CHECK_VALID_INTR_HANDLE(intr_handle); > > + if (intr_handle->efds == NULL) { > + RTE_LOG(ERR, EAL, "Event fd list not allocated\n"); > + rte_errno = EFAULT; > + goto fail; > + } > + > if (index >= intr_handle->nb_intr) { > RTE_LOG(ERR, EAL, "Invalid size %d, max limit %d\n", index, > intr_handle->nb_intr); > @@ -275,6 +378,12 @@ struct rte_epoll_event *rte_intr_elist_index_get( > { > CHECK_VALID_INTR_HANDLE(intr_handle); > > + if (intr_handle->elist == NULL) { > + RTE_LOG(ERR, EAL, "Event list not allocated\n"); > + rte_errno = EFAULT; > + goto fail; > + } > + > if (index >= intr_handle->nb_intr) { > RTE_LOG(ERR, EAL, "Invalid index %d, max limit %d\n", index, > intr_handle->nb_intr); > @@ -292,6 +401,12 @@ int rte_intr_elist_index_set(struct rte_intr_handle > *intr_handle, > { > CHECK_VALID_INTR_HANDLE(intr_handle); > > + if (intr_handle->elist == NULL) { > + RTE_LOG(ERR, EAL, "Event list not allocated\n"); > + rte_errno = EFAULT; > + goto fail; > + } > + > if (index >= intr_handle->nb_intr) { > RTE_LOG(ERR, EAL, "Invalid index %d, max limit %d\n", index, > intr_handle->nb_intr); [...]