From fdc076c7d6749ea0d63969afe74b1d158266f80f Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Wed, 18 May 2022 11:11:43 -0600 Subject: [PATCH] tools/cgdelete: fix coverity wrong argument size warning Fix a wrong argument size, reported by Coverity tool: CID 1412122 (#1 of 1): Wrong sizeof argument (SIZEOF_MISMATCH) suspicious_sizeof: Passing argument 8UL /* sizeof (struct ext_cgroup_record *) */ to function calloc and then casting the return value to struct ext_cgroup_record * is suspicious. Also, fix the typo in the variable name, that's being allocated memory. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka (cherry picked from commit 2045fcd6b3428f1b1ca226974259e00399049472) --- src/tools/cgdelete.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/cgdelete.c b/src/tools/cgdelete.c index 43cc47c2..13a86c38 100644 --- a/src/tools/cgdelete.c +++ b/src/tools/cgdelete.c @@ -155,8 +155,8 @@ int main(int argc, char *argv[]) goto err; } - ecg_list = calloc(argc, sizeof(struct ext_cgroup_record *)); - if (cgroup_list == NULL) { + ecg_list = calloc(argc, sizeof(struct ext_cgroup_record)); + if (ecg_list == NULL) { fprintf(stderr, "%s: out of memory\n", argv[0]); ret = -1; goto err; -- 2.47.2