projects
/
lttng-modules.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: use of uninitialized ret value in lttng_abi_open_metadata_stream
[lttng-modules.git]
/
probes
/
lttng-tracepoint-event-impl.h
diff --git
a/probes/lttng-tracepoint-event-impl.h
b/probes/lttng-tracepoint-event-impl.h
index a87d146af23e701349f5fa259f4fe0b823ae2168..45c38ff43b21cc6dab85b7ff72a8fe3996564725 100644
(file)
--- a/
probes/lttng-tracepoint-event-impl.h
+++ b/
probes/lttng-tracepoint-event-impl.h
@@
-23,6
+23,7
@@
#include <linux/debugfs.h>
#include <linux/rculist.h>
#include <asm/byteorder.h>
#include <linux/debugfs.h>
#include <linux/rculist.h>
#include <asm/byteorder.h>
+#include <linux/swab.h>
#include <probes/lttng.h>
#include <probes/lttng-types.h>
#include <probes/lttng.h>
#include <probes/lttng-types.h>
@@
-34,6
+35,8
@@
#include <lttng-events.h>
#include <lttng-tracer-core.h>
#include <lttng-events.h>
#include <lttng-tracer-core.h>
+#define __LTTNG_NULL_STRING "(null)"
+
/*
* Macro declarations used for all stages.
*/
/*
* Macro declarations used for all stages.
*/
@@
-391,7
+394,7
@@
static void __event_probe__##_name(void *__data);
max_t(size_t, lttng_strlen_user_inatomic(_src), 1); \
else \
__event_len += __dynamic_len[__dynamic_len_idx++] = \
max_t(size_t, lttng_strlen_user_inatomic(_src), 1); \
else \
__event_len += __dynamic_len[__dynamic_len_idx++] = \
- strlen(
_src
) + 1;
+ strlen(
(_src) ? (_src) : __LTTNG_NULL_STRING
) + 1;
#undef TP_PROTO
#define TP_PROTO(...) __VA_ARGS__
#undef TP_PROTO
#define TP_PROTO(...) __VA_ARGS__
@@
-457,18
+460,24
@@
static inline size_t __event_get_size__##_name(size_t *__dynamic_len, \
case 2: \
{ \
union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
case 2: \
{ \
union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
+ if (_byte_order != __BYTE_ORDER) \
+ __swab16s(&__tmp.v); \
__ctf_tmp_int64 = (int64_t) __tmp.v; \
break; \
} \
case 4: \
{ \
union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \
__ctf_tmp_int64 = (int64_t) __tmp.v; \
break; \
} \
case 4: \
{ \
union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \
+ if (_byte_order != __BYTE_ORDER) \
+ __swab32s(&__tmp.v); \
__ctf_tmp_int64 = (int64_t) __tmp.v; \
break; \
} \
case 8: \
{ \
union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \
__ctf_tmp_int64 = (int64_t) __tmp.v; \
break; \
} \
case 8: \
{ \
union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \
+ if (_byte_order != __BYTE_ORDER) \
+ __swab64s(&__tmp.v); \
__ctf_tmp_int64 = (int64_t) __tmp.v; \
break; \
} \
__ctf_tmp_int64 = (int64_t) __tmp.v; \
break; \
} \
@@
-488,18
+497,24
@@
static inline size_t __event_get_size__##_name(size_t *__dynamic_len, \
case 2: \
{ \
union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
case 2: \
{ \
union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
+ if (_byte_order != __BYTE_ORDER) \
+ __swab16s(&__tmp.v); \
__ctf_tmp_uint64 = (uint64_t) __tmp.v; \
break; \
} \
case 4: \
{ \
union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \
__ctf_tmp_uint64 = (uint64_t) __tmp.v; \
break; \
} \
case 4: \
{ \
union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \
+ if (_byte_order != __BYTE_ORDER) \
+ __swab32s(&__tmp.v); \
__ctf_tmp_uint64 = (uint64_t) __tmp.v; \
break; \
} \
case 8: \
{ \
union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \
__ctf_tmp_uint64 = (uint64_t) __tmp.v; \
break; \
} \
case 8: \
{ \
union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \
+ if (_byte_order != __BYTE_ORDER) \
+ __swab64s(&__tmp.v); \
__ctf_tmp_uint64 = (uint64_t) __tmp.v; \
break; \
} \
__ctf_tmp_uint64 = (uint64_t) __tmp.v; \
break; \
} \
@@
-568,7
+583,8
@@
static inline size_t __event_get_size__##_name(size_t *__dynamic_len, \
#undef _ctf_string
#define _ctf_string(_item, _src, _user, _nowrite) \
{ \
#undef _ctf_string
#define _ctf_string(_item, _src, _user, _nowrite) \
{ \
- const void *__ctf_tmp_ptr = (_src); \
+ const void *__ctf_tmp_ptr = \
+ ((_src) ? (_src) : __LTTNG_NULL_STRING); \
memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
__stack_data += sizeof(void *); \
}
memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
__stack_data += sizeof(void *); \
}
@@
-858,12
+874,16
@@
static inline size_t __event_get_align__##_name(void *__tp_locvar) \
#undef _ctf_string
#define _ctf_string(_item, _src, _user, _nowrite) \
#undef _ctf_string
#define _ctf_string(_item, _src, _user, _nowrite) \
- lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
if (_user) { \
if (_user) { \
+ lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
__chan->ops->event_strcpy_from_user(&__ctx, _src, \
__get_dynamic_len(dest)); \
} else { \
__chan->ops->event_strcpy_from_user(&__ctx, _src, \
__get_dynamic_len(dest)); \
} else { \
- __chan->ops->event_strcpy(&__ctx, _src, \
+ const char *__ctf_tmp_string = \
+ ((_src) ? (_src) : __LTTNG_NULL_STRING); \
+ lib_ring_buffer_align_ctx(&__ctx, \
+ lttng_alignof(*__ctf_tmp_string)); \
+ __chan->ops->event_strcpy(&__ctx, __ctf_tmp_string, \
__get_dynamic_len(dest)); \
}
__get_dynamic_len(dest)); \
}
This page took
0.025729 seconds
and
4
git commands to generate.