Skip to content

Commit

Permalink
eventdev: fix calloc parameters
Browse files Browse the repository at this point in the history
[ upstream commit 09fbda36e495bc6f24fbe26d0909801107bee5f7 ]

gcc [1] generates warning [2] about calloc usage, because calloc
parameter order is wrong, fixing it by replacing parameters.

[1]
gcc (GCC) 14.0.1 20240124 (experimental)

[2]
Compiling C object lib/librte_eventdev.a.p/eventdev_rte_eventdev.c.o
../lib/eventdev/rte_eventdev.c: In function ‘handle_dev_dump’:
../lib/eventdev/rte_eventdev.c:2005:29:
  warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier
  argument and not in the later argument [-Wcalloc-transposed-args]
 2005 |     buf = calloc(sizeof(char), RTE_TEL_MAX_SINGLE_STRING_LEN);
      |                         ^~~~

Fixes: a3b7b47 ("eventdev: support telemetry dump eventdev")

Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
  • Loading branch information
ferruhy authored and bluca committed Mar 7, 2024
1 parent eb18df7 commit 5b9e406
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/eventdev/rte_eventdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@ handle_dev_dump(const char *cmd __rte_unused,

RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);

buf = calloc(sizeof(char), RTE_TEL_MAX_SINGLE_STRING_LEN);
buf = calloc(RTE_TEL_MAX_SINGLE_STRING_LEN, sizeof(char));
if (buf == NULL)
return -ENOMEM;

Expand Down

0 comments on commit 5b9e406

Please sign in to comment.