Skip to content

Commit

Permalink
dpdk: suppress scan-build warnings
Browse files Browse the repository at this point in the history
 source-dpdk.c:201:21: warning: Access to field 'dev' results in a dereference of a null pointer (loaded from field 'livedev') [core.NullDereference]
  201 |                     ptv->livedev->dev, rte_strerror(-retval), flush_error.message);
      |                     ^~~~~~~~~~~~~~~~~
./util-debug.h:262:74: note: expanded from macro 'SCLogError'
  262 |     SCLogErr(SC_LOG_ERROR, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
      |                                                                          ^~~~~~~~~~~
source-dpdk.c:641:17: warning: Potential leak of memory pointed to by 'ptv' [unix.Malloc]
  641 |     SCReturnInt(TM_ECODE_FAILED);
      |                 ^~~~~~~~~~~~~~~
./util-debug.h:275:48: note: expanded from macro 'SCReturnInt'
  275 | #define SCReturnInt(x)                  return x
      |                                                ^
source-dpdk.c:732:67: warning: Access to field 'dev' results in a dereference of a null pointer (loaded from field 'livedev') [core.NullDereference]
  732 |             SCLogError("%s: error (%s) when getting device info", ptv->livedev->dev,
      |                                                                   ^~~~~~~~~~~~~~~~~
./util-debug.h:262:74: note: expanded from macro 'SCLogError'
  262 |     SCLogErr(SC_LOG_ERROR, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
      |                                                                          ^~~~~~~~~~~
3 warnings generated.
  • Loading branch information
victorjulien committed Jul 14, 2024
1 parent a585c0a commit c54306c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/source-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,18 +724,19 @@ static TmEcode ReceiveDPDKThreadDeinit(ThreadVars *tv, void *data)
{
SCEnter();
DPDKThreadVars *ptv = (DPDKThreadVars *)data;
if (ptv == NULL)
SCReturnInt(TM_ECODE_OK);

if (ptv->queue_id == 0) {
struct rte_eth_dev_info dev_info;
int retval = rte_eth_dev_info_get(ptv->port_id, &dev_info);
if (retval != 0) {
SCLogError("%s: error (%s) when getting device info", ptv->livedev->dev,
if (retval == 0) {
DevicePreClosePMDSpecificActions(ptv, dev_info.driver_name);
} else {
SCLogWarning("%s: error (%s) when getting device info", ptv->livedev->dev,
rte_strerror(-retval));
SCReturnInt(TM_ECODE_FAILED);
}

DevicePreClosePMDSpecificActions(ptv, dev_info.driver_name);

if (ptv->workers_sync) {
SCFree(ptv->workers_sync);
}
Expand Down

0 comments on commit c54306c

Please sign in to comment.