[lttng-dev] [PATCH lttng-tools 2/2] Fix: handle syscall table resizing if nbmem is equal to zero

Jonathan Rajotte jonathan.rajotte-julien at efficios.com
Mon Mar 13 22:13:17 UTC 2017


LTTng-modules returns indexes starting from zero. Hence, if nbmem is zero
and index is zero the table will fail to grow to contain one
element.

This situation should never happen since nbmem is assigned the value of
SYSCALL_TABLE_INIT_SIZE which is 256 currently.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
 src/bin/lttng-sessiond/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/lttng-sessiond/syscall.c b/src/bin/lttng-sessiond/syscall.c
index c21e4d8..51214bf 100644
--- a/src/bin/lttng-sessiond/syscall.c
+++ b/src/bin/lttng-sessiond/syscall.c
@@ -85,7 +85,7 @@ int syscall_init_table(void)
 			size_t new_nbmem;
 
 			/* Double memory size. */
-			new_nbmem = max(index, nbmem << 1);
+			new_nbmem = max(index + 1, nbmem << 1);
 			if (new_nbmem > (SIZE_MAX / sizeof(*new_list))) {
 				/* Overflow, stop everything, something went really wrong. */
 				ERR("Syscall listing memory size overflow. Stopping");
-- 
2.7.4



More information about the lttng-dev mailing list