This patch fixes (dereference after null check) coverity issue.
For this reason, we should add null check at the beginning of the
function and return error directly if the 'intr_handle' is null.
Coverity issue: 357695, 357751
Fixes:
05c4105738d8 ("trace: add interrupt tracepoints")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Harman Kalra <hkalra@marvell.com>
{
int rc = 0;
- if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) {
+ if (intr_handle == NULL)
+ return -1;
+
+ if (intr_handle->type == RTE_INTR_HANDLE_VDEV) {
rc = 0;
goto out;
}
- if (!intr_handle || intr_handle->fd < 0 ||
- intr_handle->uio_cfg_fd < 0) {
+ if (intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) {
rc = -1;
goto out;
}
{
int rc = 0;
- if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) {
+ if (intr_handle == NULL)
+ return -1;
+
+ if (intr_handle->type == RTE_INTR_HANDLE_VDEV) {
rc = 0;
goto out;
}
- if (!intr_handle || intr_handle->fd < 0 ||
- intr_handle->uio_cfg_fd < 0) {
+ if (intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) {
rc = -1;
goto out;
}
{
int rc = 0;
- if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) {
+ if (intr_handle == NULL)
+ return -1;
+
+ if (intr_handle->type == RTE_INTR_HANDLE_VDEV) {
rc = 0;
goto out;
}
- if (!intr_handle || intr_handle->fd < 0 ||
- intr_handle->uio_cfg_fd < 0) {
+ if (intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) {
rc = -1;
goto out;
}
{
int rc = 0;
- if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) {
+ if (intr_handle == NULL)
+ return -1;
+
+ if (intr_handle->type == RTE_INTR_HANDLE_VDEV) {
rc = 0;
goto out;
}
- if (!intr_handle || intr_handle->fd < 0 ||
- intr_handle->uio_cfg_fd < 0) {
+ if (intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) {
rc = -1;
goto out;
}