Project

General

Profile

Actions

Bug #1415

closed

Type mismatch of lttng_ust_ring_buffer_ctx_init (int versus size_t)

Added by Joonhyung Hwang 10 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
07/16/2024
Due date:
% Done:

0%

Estimated time:

Description

Hello, we run static analysis tools for our code and saw the following message.

CERT-C Expression (CERT EXP37-C)
1. cert_exp37_c_violation: Calling function lttng_ust_ring_buffer_ctx_init(struct lttng_ust_ring_buffer_ctx *, void *, size_t, int, struct lttng_ust_probe_ctx *) with the argument __event_align, which has an incompatible type size_t instead of int.

The type of the fourth parameter of lttng_ust_ring_buffer_ctx_init() in include/lttng/ust-ringbuffer-context.h is int, but the fourth argument of lttng_ust_ring_buffer_ctx_init() in include/lttng/ust-tracepoint-event.h is __event_align whose type is int. I think we can make the types match by using size_t.

Actions #1

Updated by Mathieu Desnoyers about 1 month ago

  • Status changed from New to Resolved

Fixed by:

commit 83bbc50efd0017f52f38778b44981a6a565fc1e5
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date:   Tue Apr 1 14:43:35 2025 -0400

    Fix: Use size_t type for lttng_ust_ring_buffer_ctx_init largest_align argument

    The type "size_t" is used by all callers and internally, so change the
    type from "int" to "size_t" for this argument.

    Fixes: #1415
    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Change-Id: Idebcc0bbbbcf3fe9cea4c6cc8de1dc5af86f8db8

Actions

Also available in: Atom PDF