Skip to content

Commit 19139aa

Browse files
authored
Merge pull request #27 from IBM/jo5ta/dev
Fix kernel module build warnings
2 parents c71a76d + 4cfec7e commit 19139aa

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

VERSION.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
1.2.61
1+
1.2.62
22

33
# Change log
4+
## 1.2.62
5+
- fix: kernel module build warnings
46
## 1.2.61
57
- fix: release workflow copies SRPM to workspace before creating checksums
68
## 1.2.60

kernel_tracing_library/src/abstraction/error.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33

44
#include "abstraction/error.h"
55
#include <linux/kernel.h>
6+
#include <linux/objtool.h>
67
#include <linux/printk.h>
78

89
__attribute__((noreturn)) static void
910
default_unrecoverbale_error_callback(const char *const message)
1011
{
1112
pr_emerg("%s", message);
12-
panic(message);
13+
panic("%s", message);
1314
while (1)
1415
; // panic will never return.
1516
// To fix a error reported by objtool this loop is necessary
@@ -18,7 +19,8 @@ default_unrecoverbale_error_callback(const char *const message)
1819
void clltk_unrecoverbale_error_callback(const char *const)
1920
__attribute__((weak, noreturn, alias("default_unrecoverbale_error_callback")));
2021

21-
void unrecoverable_error(const char *file, size_t line, const char *func, const char *format, ...)
22+
__attribute__((noreturn)) void unrecoverable_error(const char *file, size_t line, const char *func,
23+
const char *format, ...)
2224
{
2325
char clltk_format[1024];
2426
char clltk_message[512];
@@ -36,7 +38,9 @@ void unrecoverable_error(const char *file, size_t line, const char *func, const
3638
va_end(args);
3739

3840
clltk_unrecoverbale_error_callback(clltk_message);
41+
__builtin_unreachable();
3942
}
43+
STACK_FRAME_NON_STANDARD(unrecoverable_error);
4044

4145
void recoverable_error(const char *file, size_t line, const char *func, const char *format, ...)
4246
{

kernel_tracing_library/src/initialization.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
// Copyright (c) 2024, International Business Machines
22
// SPDX-License-Identifier: BSD-2-Clause-Patent
33

4-
#include "CommonLowLevelTracingKit/tracing/tracing.h"
5-
6-
#include "abstraction/memory.h"
7-
#include <c-vector/vec.h>
8-
94
#include <linux/elf.h>
105
#include <linux/kallsyms.h>
116
#include <linux/kernel.h>
127
#include <linux/slab.h>
138
#include <linux/string.h>
149

10+
// Forward declarations for functions exported by this module
11+
void _clltk_init_tracing_for_this_module(const struct mod_kallsyms *const allsyms);
12+
void _clltk_deinit_tracing_for_this_module(const struct mod_kallsyms *const allsyms);
13+
14+
#include "CommonLowLevelTracingKit/tracing/tracing.h"
15+
16+
#include "abstraction/memory.h"
17+
#include <c-vector/vec.h>
18+
1519
typedef struct {
1620
const char *name;
1721
_clltk_tracebuffer_handler_t **tracebuffers;

kernel_tracing_library/src/module.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ static void __exit exit_clltk_kf(void) {}
2020
module_init(init_clltk_kf);
2121
module_exit(exit_clltk_kf);
2222
MODULE_LICENSE("Dual BSD/GPL");
23+
MODULE_DESCRIPTION("Common Low Level Tracing Kit (CLLTK) kernel tracing module");

tracing_library/source/tracepoint.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ void _clltk_static_tracepoint_with_args(_clltk_tracebuffer_handler_t *handler,
4646
...)
4747
{
4848
if (unlikely(false == _CLLTK_FILE_OFFSET_IS_STATIC(in_file_offset))) {
49-
ERROR_LOG("invalid in_file_offset(%lu) at %s:%d for %s", in_file_offset, file, line,
50-
handler->definition.name);
49+
ERROR_LOG("invalid in_file_offset(%llu) at %s:%d for %s",
50+
(unsigned long long)in_file_offset, file, line, handler->definition.name);
5151
return;
5252
}
5353

@@ -111,8 +111,8 @@ void _clltk_static_tracepoint_with_dump(_clltk_tracebuffer_handler_t *handler,
111111
const void *address, uint32_t size_in_bytes)
112112
{
113113
if (unlikely(false == _CLLTK_FILE_OFFSET_IS_STATIC(in_file_offset))) {
114-
ERROR_LOG("invalid in_file_offset(%lu) at %s:%d for %s", in_file_offset, file, line,
115-
handler->definition.name);
114+
ERROR_LOG("invalid in_file_offset(%llu) at %s:%d for %s",
115+
(unsigned long long)in_file_offset, file, line, handler->definition.name);
116116
return;
117117
}
118118

0 commit comments

Comments
 (0)