From 477b83a4de8580a75e3aa88de423c7081e49d6e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 7 Apr 2021 12:54:09 -0400 Subject: [PATCH] Fix: sessiond: error accounting: wrong sizeof argument cpu_counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit `cpu_counters` is an array of `struct lttng_ust_abi_object_data *`, not of `struct lttng_ust_abi_object_data`. This didn't cause any problems since the structure is larger than a pointer. 1452203 Wrong sizeof argument The wrong sizeof value is used in an expression or as argument to a function. The result is an incorrect value that may cause unexpected program behaviors. In event_notifier_error_accounting_register_app: The sizeof operator is invoked on the wrong argument (CWE-569) Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: I9278949aab0a98f050ec232d7b8ce024240020d0 --- src/bin/lttng-sessiond/event-notifier-error-accounting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/event-notifier-error-accounting.c b/src/bin/lttng-sessiond/event-notifier-error-accounting.c index f0e567f72..cb8380251 100644 --- a/src/bin/lttng-sessiond/event-notifier-error-accounting.c +++ b/src/bin/lttng-sessiond/event-notifier-error-accounting.c @@ -438,7 +438,7 @@ event_notifier_error_accounting_register_app(struct ust_app *app) goto error_send_counter_data; } - cpu_counters = zmalloc(entry->nr_counter_cpu_fds * sizeof(struct lttng_ust_abi_object_data)); + cpu_counters = zmalloc(entry->nr_counter_cpu_fds * sizeof(struct lttng_ust_abi_object_data *)); if (!cpu_counters) { PERROR("Failed to allocate event notifier error counter lttng_ust_abi_object_data array: application uid = %d, application name = '%s', pid = %d, allocation size = %zu", (int) app->uid, app->name, (int) app->pid, -- 2.34.1