dpdk: fix cppcheck warnings

src/runmode-dpdk.c:202:11: warning: Size of pointer 'argv' used instead of size of its data. This is likely to lead to a buffer overflow. You probably intend to write 'sizeof(*argv)'. [pointerSize]
    args->argv = SCCalloc(capacity, sizeof(args->argv));
          ^
src/runmode-dpdk.c:777:23: error: Shifting 32-bit value by 63 bits is undefined behaviour [shiftTooManyBits]
        if (bits & (1 << i))
                      ^
src/runmode-dpdk.c:776:23: note: Assuming that condition 'i<64' is not redundant
    for (int i = 0; i < 64; i++) {
                      ^
src/runmode-dpdk.c:777:23: note: Shift
        if (bits & (1 << i))
                      ^
pull/8288/head
Victor Julien 3 years ago
parent 17cd41c887
commit 58c28d1778

@ -199,7 +199,7 @@ static char *AllocAndSetOption(const char *arg)
static void ArgumentsInit(struct Arguments *args, unsigned capacity)
{
SCEnter();
args->argv = SCCalloc(capacity, sizeof(args->argv));
args->argv = SCCalloc(capacity, sizeof(ptrdiff_t)); // alloc array of pointers
if (args->argv == NULL)
FatalError(SC_ERR_MEM_ALLOC, "Could not allocate memory for Arguments structure");
@ -790,8 +790,8 @@ static void DeviceSetPMDSpecificRSS(struct rte_eth_rss_conf *rss_conf, const cha
// Returns -1 if no bit is set
static int GetFirstSetBitPosition(uint64_t bits)
{
for (int i = 0; i < 64; i++) {
if (bits & (1 << i))
for (uint64_t i = 0; i < 64; i++) {
if (bits & BIT_U64(i))
return i;
}
return -1;

Loading…
Cancel
Save