Skip to content

eBPF-based security platform

style: mark unused parameters

John Fastabend5e989ec43d23
diff --git a/bpf/unload.c b/bpf/unload.c
index 82e7f80f..9dc6282f 100644
--- a/bpf/unload.c
+++ b/bpf/unload.c
@@ -25,7 +25,7 @@ volatile const struct unload_params shirudo_unload_params = {
char _license[] SEC("license") = "Dual BSD/GPL";
SEC("syscall")
-int shirudo_unload(void *ctx)
+int shirudo_unload(void *ctx __attribute__((__unused__)))
{
/*
* TODO: look up /run/shirudo/bpffs/upatches/<name>/link
diff --git a/builtin-bpm.c b/builtin-bpm.c
index 4a55aad6..783cb2e6 100644
--- a/builtin-bpm.c
+++ b/builtin-bpm.c
@@ -1148,7 +1148,8 @@ static void sort_old_pairs(char (*unloads)[PATH_MAX], char (*loads)[PATH_MAX],
#define INSTALL_PATHS_MAX 128
static int package_install(const struct bpm_source *s, const struct bpm_index_entry *entry,
- const char *old_path, const char *old_version)
+ const char *old_path,
+ const char *old_version __attribute__((__unused__)))
{
struct bpm_oci_client c __cleanup(bpm_oci_client_clear) = {};
struct bpm_descriptor layers[8];
@@ -2282,8 +2283,9 @@ static void bpm_tree_usage(void)
"`shirudo bpm tree append --help` where the operator package is installed.\n");
}
-static int remove_tree_entry(const char *path, const struct stat *st,
- int type, struct FTW *ftw)
+static int remove_tree_entry(const char *path,
+ const struct stat *st __attribute__((__unused__)),
+ int type, struct FTW *ftw __attribute__((__unused__)))
{
if (type == FTW_DP || type == FTW_D)
return rmdir(path) ? -1 : 0;
diff --git a/builtin-init.c b/builtin-init.c
index d2ef25c7..c2f748f7 100644
--- a/builtin-init.c
+++ b/builtin-init.c
@@ -476,7 +476,8 @@ struct anchor_keys {
};
static void collect_asymmetric(key_serial_t serial, const char *type,
- const char *description, void *ud)
+ const char *description __attribute__((__unused__)),
+ void *ud)
{
struct anchor_keys *k = ud;
diff --git a/builtin-status.c b/builtin-status.c
index 0e593979..e03e9fc4 100644
--- a/builtin-status.c
+++ b/builtin-status.c
@@ -329,7 +329,8 @@ static void print_system_human(const struct sysinfo *si)
printf(" %-16s %s\n", "Boot ID:", si->boot_id);
}
-static void print_kernel_config_entry(void *ctx, const char *key,
+static void print_kernel_config_entry(void *ctx __attribute__((__unused__)),
+ const char *key,
const char *value)
{
printf(" %s=%s\n", key, value);
diff --git a/testing/helper/test-config-attest.c b/testing/helper/test-config-attest.c
index 81b3ab45..13237a68 100644
--- a/testing/helper/test-config-attest.c
+++ b/testing/helper/test-config-attest.c
@@ -20,7 +20,8 @@
#include "util/malloc.h"
#include "util/tpm.h"
-static int boot_identity(void *ctx, __u32 *reset, __u32 *restart)
+static int boot_identity(void *ctx __attribute__((__unused__)),
+ __u32 *reset, __u32 *restart)
{
struct tpm *tpm = NULL;
int ret;
@@ -32,7 +33,8 @@ static int boot_identity(void *ctx, __u32 *reset, __u32 *restart)
return ret;
}
-static int pcr_read(void *ctx, __u32 pcr, __u8 out[32])
+static int pcr_read(void *ctx __attribute__((__unused__)),
+ __u32 pcr, __u8 out[32])
{
struct tpm *tpm = NULL;
int ret;
@@ -44,18 +46,22 @@ static int pcr_read(void *ctx, __u32 pcr, __u8 out[32])
return ret;
}
-static int no_extend(void *ctx, __u32 pcr, const __u8 event[32])
+static int no_extend(void *ctx __attribute__((__unused__)),
+ __u32 pcr __attribute__((__unused__)),
+ const __u8 event[32] __attribute__((__unused__)))
{
return -EPERM;
}
-static int no_activate(void *ctx,
- const struct config_update_target *target)
+static int no_activate(void *ctx __attribute__((__unused__)),
+ const struct config_update_target *target
+ __attribute__((__unused__)))
{
return -EPERM;
}
-static int no_seal(void *ctx, int fd)
+static int no_seal(void *ctx __attribute__((__unused__)),
+ int fd __attribute__((__unused__)))
{
return 0;
}
diff --git a/testing/helper/test-config-update.c b/testing/helper/test-config-update.c
index 76b814e4..229c2fb5 100644
--- a/testing/helper/test-config-update.c
+++ b/testing/helper/test-config-update.c
@@ -193,12 +193,13 @@ static int test_activate(void *opaque,
return simulator_save(ctx);
}
-static int test_seal(void *opaque, int fd)
+static int test_seal(void *opaque __attribute__((__unused__)),
+ int fd __attribute__((__unused__)))
{
return getenv("SHIRUDO_TEST_CONFIG_SEAL_FAIL") ? -EPERM : 0;
}
-static int test_checkpoint(void *opaque,
+static int test_checkpoint(void *opaque __attribute__((__unused__)),
enum config_update_checkpoint checkpoint)
{
const char *crash = getenv("SHIRUDO_TEST_CONFIG_CRASH");
diff --git a/testing/helper/test-eventlog.c b/testing/helper/test-eventlog.c
index a61b1d26..e0de89cd 100644
--- a/testing/helper/test-eventlog.c
+++ b/testing/helper/test-eventlog.c
@@ -64,7 +64,8 @@ static int append_init(const char *path, const char *bound_in,
return eventlog_append_to(path, buf);
}
-static int count_lines(const char *line, size_t len, void *ctx)
+static int count_lines(const char *line __attribute__((__unused__)),
+ size_t len __attribute__((__unused__)), void *ctx)
{
__u32 *n = ctx;
diff --git a/testing/helper/test-image-cli.c b/testing/helper/test-image-cli.c
index d1bc3de1..aff5b355 100644
--- a/testing/helper/test-image-cli.c
+++ b/testing/helper/test-image-cli.c
@@ -4,19 +4,29 @@
#include "../../builtin-bpm.c"
#include "util/config.h"
-int __wrap_bpm_tree_fetch_publication(struct bpm_oci_client *client,
- const char *repository,
- const char *reference,
+int __wrap_bpm_tree_fetch_publication(struct bpm_oci_client *client
+ __attribute__((__unused__)),
+ const char *repository
+ __attribute__((__unused__)),
+ const char *reference
+ __attribute__((__unused__)),
const char *certificate,
- struct tree_publication *pub,
- char *digest, size_t capacity);
+ struct tree_publication *pub
+ __attribute__((__unused__)),
+ char *digest __attribute__((__unused__)),
+ size_t capacity __attribute__((__unused__)));
-int __wrap_bpm_tree_fetch_publication(struct bpm_oci_client *client,
- const char *repository,
- const char *reference,
+int __wrap_bpm_tree_fetch_publication(struct bpm_oci_client *client
+ __attribute__((__unused__)),
+ const char *repository
+ __attribute__((__unused__)),
+ const char *reference
+ __attribute__((__unused__)),
const char *certificate,
- struct tree_publication *pub,
- char *digest, size_t capacity)
+ struct tree_publication *pub
+ __attribute__((__unused__)),
+ char *digest __attribute__((__unused__)),
+ size_t capacity __attribute__((__unused__)))
{
puts(certificate);
return 0;
diff --git a/testing/helper/test-image-keys.c b/testing/helper/test-image-keys.c
index 2a761567..e5440ba6 100644
--- a/testing/helper/test-image-keys.c
+++ b/testing/helper/test-image-keys.c
@@ -35,7 +35,8 @@ key_serial_t keyring_bpf_serial(void)
return 42;
}
-int keyring_holds_cert(key_serial_t ring, const __u8 *der,
+int keyring_holds_cert(key_serial_t ring __attribute__((__unused__)),
+ const __u8 *der,
size_t size)
{
int i;
@@ -56,20 +57,24 @@ int keyring_holds_cert(key_serial_t ring, const __u8 *der,
return 0;
}
-int keys_revoke_image(const __u8 *der, size_t size, bool boot)
+int keys_revoke_image(const __u8 *der __attribute__((__unused__)),
+ size_t size __attribute__((__unused__)),
+ bool boot __attribute__((__unused__)))
{
mutations++;
return -EPERM;
}
-static int boot_count(void *opaque, __u32 *reset, __u32 *restart)
+static int boot_count(void *opaque __attribute__((__unused__)),
+ __u32 *reset, __u32 *restart)
{
*reset = 1;
*restart = 1;
return 0;
}
-static int pcr_read(void *opaque, __u32 pcr, __u8 out[32])
+static int pcr_read(void *opaque, __u32 pcr __attribute__((__unused__)),
+ __u8 out[32])
{
struct test_context *ctx = opaque;
@@ -77,7 +82,8 @@ static int pcr_read(void *opaque, __u32 pcr, __u8 out[32])
return 0;
}
-static int pcr_extend(void *opaque, __u32 pcr, const __u8 event[32])
+static int pcr_extend(void *opaque, __u32 pcr __attribute__((__unused__)),
+ const __u8 event[32])
{
struct test_context *ctx = opaque;
@@ -86,7 +92,8 @@ static int pcr_extend(void *opaque, __u32 pcr, const __u8 event[32])
}
static int prepare(void *opaque,
- const struct config_update_target *target)
+ const struct config_update_target *target
+ __attribute__((__unused__)))
{
struct test_context *ctx = opaque;
@@ -94,7 +101,8 @@ static int prepare(void *opaque,
}
static int activate(void *opaque,
- const struct config_update_target *target)
+ const struct config_update_target *target
+ __attribute__((__unused__)))
{
struct test_context *ctx = opaque;
@@ -106,7 +114,8 @@ static int activate(void *opaque,
return 0;
}
-static int seal(void *opaque, int fd)
+static int seal(void *opaque __attribute__((__unused__)),
+ int fd __attribute__((__unused__)))
{
return 0;
}
diff --git a/testing/helper/test-upatch-decode.c b/testing/helper/test-upatch-decode.c
index 0efd801f..97110945 100644
--- a/testing/helper/test-upatch-decode.c
+++ b/testing/helper/test-upatch-decode.c
@@ -11,7 +11,8 @@
#include "util/upatch_decode.h"
#include "util/upatch_maps.h"
-static int dump_chunk(lua_State *L, const void *p, size_t sz, void *ud)
+static int dump_chunk(lua_State * __attribute__((__unused__)) L,
+ const void *p, size_t sz, void *ud)
{
return fwrite(p, 1, sz, ud) == sz ? 0 : 1;
}
diff --git a/tools/shirudo-build/bpm-build.c b/tools/shirudo-build/bpm-build.c
index 9fafd7d5..b5caf6cd 100644
--- a/tools/shirudo-build/bpm-build.c
+++ b/tools/shirudo-build/bpm-build.c
@@ -692,17 +692,14 @@ void bpm_build_spec_free(struct bpm_build_spec *spec)
if (!spec)
return;
for (size_t i = 0; i < spec->n_upatches; i++) {
- if (spec->upatches[i].tree.selector)
- xfree(spec->upatches[i].tree.selector,
- sizeof(*spec->upatches[i].tree.selector));
- if (spec->upatches[i].rodata)
- xfree(spec->upatches[i].rodata,
- BPM_BUILD_MAX_RODATA *
- sizeof(*spec->upatches[i].rodata));
- if (spec->upatches[i].policies)
- xfree(spec->upatches[i].policies,
- BPM_BUILD_MAX_POLICIES *
- sizeof(*spec->upatches[i].policies));
+ xfree(spec->upatches[i].tree.selector,
+ sizeof(*spec->upatches[i].tree.selector));
+ xfree(spec->upatches[i].rodata,
+ BPM_BUILD_MAX_RODATA *
+ sizeof(*spec->upatches[i].rodata));
+ xfree(spec->upatches[i].policies,
+ BPM_BUILD_MAX_POLICIES *
+ sizeof(*spec->upatches[i].policies));
}
xfree(spec->build_file, spec->build_file_len + 1);
xfree(spec, sizeof(*spec));
@@ -1312,8 +1309,7 @@ static int build_upatches(struct bpm_build_spec *spec, const char *pkey,
}
ret = build_package_load(bpf_o, src_path, load, name,
labels, nr_labels, pkey, cert);
- if (labels)
- xfree(labels, (size_t)nr_labels * sizeof(*labels));
+ xfree(labels, (size_t)nr_labels * sizeof(*labels));
if (bpf_o == object)
unlink(object);
if (ret)
diff --git a/tools/shirudo-build/package.c b/tools/shirudo-build/package.c
index 4ec2e327..b838f0b0 100644
--- a/tools/shirudo-build/package.c
+++ b/tools/shirudo-build/package.c
@@ -1866,10 +1866,8 @@ int build_package_load(const char *bpf_o, const char *src_path,
label_blob, label_len, pkey_path, cert_path);
obj = NULL;
out:
- if (obj)
- bpf_object__close(obj);
- if (label_blob)
- xfree(label_blob, label_len);
+ bpf_object__close(obj);
+ xfree(label_blob, label_len);
unregister_target_attach_types(handler_ids);
return err;
}
diff --git a/upatches/kernel-obs/kernel-obs.bpf.c b/upatches/kernel-obs/kernel-obs.bpf.c
index f41b826e..7fb8d0fb 100644
--- a/upatches/kernel-obs/kernel-obs.bpf.c
+++ b/upatches/kernel-obs/kernel-obs.bpf.c
@@ -105,7 +105,7 @@ int track_dns_response(struct __sk_buff *skb)
/* Runs once right after attachment and sizes every table in the arena. */
SEC("syscall")
-int shirudo_test__kernel_obs(void *ctx)
+int shirudo_test__kernel_obs(void *ctx __attribute__((__unused__)))
{
__u64 now = obs_now();
int ret;
diff --git a/upatches/kernel-obs/obs_exec.bpf.c b/upatches/kernel-obs/obs_exec.bpf.c
index 4f1c768d..52716ace 100644
--- a/upatches/kernel-obs/obs_exec.bpf.c
+++ b/upatches/kernel-obs/obs_exec.bpf.c
@@ -147,7 +147,8 @@ int BPF_PROG(obs_exec, struct linux_binprm *bprm)
}
SEC("lsm/task_alloc")
-int BPF_PROG(obs_task_alloc, struct task_struct *child, __u64 clone_flags)
+int BPF_PROG(obs_task_alloc, struct task_struct *child,
+ __u64 clone_flags __attribute__((__unused__)))
{
struct task_struct *parent = bpf_get_current_task_btf();
struct obs_task_meta *meta, *inherited;
diff --git a/upatches/kernel-obs/obs_net.bpf.c b/upatches/kernel-obs/obs_net.bpf.c
index 21228ed6..6fdfba0e 100644
--- a/upatches/kernel-obs/obs_net.bpf.c
+++ b/upatches/kernel-obs/obs_net.bpf.c
@@ -619,7 +619,8 @@ int BPF_PROG(obs_socket_create, struct socket *sock, int family, int type,
}
SEC("lsm/sock_graft")
-int BPF_PROG(obs_sock_graft, struct sock *sk, struct socket *parent)
+int BPF_PROG(obs_sock_graft, struct sock *sk,
+ struct socket *parent __attribute__((__unused__)))
{
struct obs_sock_meta *meta;
struct net_key key = {};
@@ -793,7 +794,8 @@ int BPF_PROG(obs_socket_bind, struct socket *sock, struct sockaddr *address,
}
SEC("lsm/socket_accept")
-int BPF_PROG(obs_socket_accept, struct socket *sock, struct socket *newsock)
+int BPF_PROG(obs_socket_accept, struct socket *sock,
+ struct socket *newsock __attribute__((__unused__)))
{
__u64 now = obs_now();
struct sock *sk;
@@ -810,8 +812,9 @@ int BPF_PROG(obs_socket_accept, struct socket *sock, struct socket *newsock)
}
SEC("lsm/socket_recvmsg")
-int BPF_PROG(obs_socket_recvmsg, struct socket *sock, struct msghdr *msg,
- int size, int flags)
+int BPF_PROG(obs_socket_recvmsg, struct socket *sock,
+ struct msghdr *msg __attribute__((__unused__)), int size,
+ int flags __attribute__((__unused__)))
{
__u64 now = obs_now();
struct sock *sk;
@@ -846,7 +849,8 @@ int BPF_PROG(obs_socket_setsockopt, struct socket *sock, int level,
}
SEC("lsm/socket_shutdown")
-int BPF_PROG(obs_socket_shutdown, struct socket *sock, int how)
+int BPF_PROG(obs_socket_shutdown, struct socket *sock,
+ int how __attribute__((__unused__)))
{
__u64 now = obs_now();
struct sock *sk;
@@ -864,7 +868,7 @@ int BPF_PROG(obs_socket_shutdown, struct socket *sock, int how)
SEC("lsm/socket_socketpair")
int BPF_PROG(obs_socket_socketpair, struct socket *socka,
- struct socket *sockb)
+ struct socket *sockb __attribute__((__unused__)))
{
__u64 now = obs_now();
struct sock *sk;
diff --git a/upatches/kernel-obs/obs_priv.bpf.c b/upatches/kernel-obs/obs_priv.bpf.c
index 56a18429..93615d10 100644
--- a/upatches/kernel-obs/obs_priv.bpf.c
+++ b/upatches/kernel-obs/obs_priv.bpf.c
@@ -239,8 +239,10 @@ int BPF_PROG(obs_ptrace, struct task_struct *child, unsigned int mode)
}
SEC("lsm.s/sb_mount")
-int BPF_PROG(obs_mount, const char *dev_name, const struct path *path,
- const char *type, unsigned long flags, void *data)
+int BPF_PROG(obs_mount,
+ const char *dev_name __attribute__((__unused__)),
+ const struct path *path, const char *type, unsigned long flags,
+ void *data __attribute__((__unused__)))
{
struct priv_entry __arena *e;
struct obs_ident ident;
@@ -269,7 +271,8 @@ int BPF_PROG(obs_mount, const char *dev_name, const struct path *path,
SEC("lsm.s/kernel_read_file")
int BPF_PROG(obs_kernel_read_file, struct file *filp,
- enum kernel_read_file_id id, bool contents)
+ enum kernel_read_file_id id,
+ bool contents __attribute__((__unused__)))
{
struct priv_entry __arena *e;
struct obs_ident ident;
@@ -292,7 +295,8 @@ int BPF_PROG(obs_kernel_read_file, struct file *filp,
}
SEC("lsm/kernel_load_data")
-int BPF_PROG(obs_kernel_load_data, enum kernel_load_data_id id, bool contents)
+int BPF_PROG(obs_kernel_load_data, enum kernel_load_data_id id,
+ bool contents __attribute__((__unused__)))
{
struct obs_ident ident;
__u64 now = obs_now();
@@ -325,7 +329,8 @@ int BPF_PROG(obs_module_request, char *kmod_name)
}
SEC("lsm/mmap_file")
-int BPF_PROG(obs_mmap_file, struct file *filp, unsigned long reqprot,
+int BPF_PROG(obs_mmap_file, struct file *filp,
+ unsigned long reqprot __attribute__((__unused__)),
unsigned long prot, unsigned long flags)
{
struct priv_entry __arena *e;
@@ -350,7 +355,8 @@ int BPF_PROG(obs_mmap_file, struct file *filp, unsigned long reqprot,
SEC("lsm/file_mprotect")
int BPF_PROG(obs_file_mprotect, struct vm_area_struct *vma,
- unsigned long reqprot, unsigned long prot)
+ unsigned long reqprot __attribute__((__unused__)),
+ unsigned long prot)
{
struct priv_entry __arena *e;
struct obs_ident ident = {};
@@ -424,8 +430,9 @@ static __always_inline bool obs_bpf_cmd_readonly(int cmd)
}
SEC("lsm/bpf")
-int BPF_PROG(obs_bpf, int cmd, union bpf_attr *attr, unsigned int size,
- bool kernel)
+int BPF_PROG(obs_bpf, int cmd,
+ union bpf_attr *attr __attribute__((__unused__)),
+ unsigned int size __attribute__((__unused__)), bool kernel)
{
struct obs_ident ident;
__u64 now = obs_now();
diff --git a/util/eventlog.c b/util/eventlog.c
index 335f53e3..da1574bf 100644
--- a/util/eventlog.c
+++ b/util/eventlog.c
@@ -238,7 +238,8 @@ struct adopt_ctx {
bool found;
};
-static int adopt_seen(const char *line, size_t len, bool is_init, void *ctx)
+static int adopt_seen(const char *line, size_t len,
+ bool is_init __attribute__((__unused__)), void *ctx)
{
struct adopt_ctx *a = ctx;
diff --git a/util/image_runtime.c b/util/image_runtime.c
index 432bfb24..6207f90c 100644
--- a/util/image_runtime.c
+++ b/util/image_runtime.c
@@ -390,7 +390,7 @@ int image_runtime_mount(void)
return mount_runtime(false);
}
-static int seal_fd(void *ctx, int fd)
+static int seal_fd(void *ctx __attribute__((__unused__)), int fd)
{
return fsetxattr(fd, XATTR_NAME, SEAL_LABEL,
strlen(SEAL_LABEL), 0) ?
@@ -626,13 +626,15 @@ static int prepare_update(void *ctx,
}
static int activate_update(void *ctx,
- const struct config_update_target *target)
+ const struct config_update_target *target
+ __attribute__((__unused__)))
{
return activate_config(ctx, false);
}
static int activate_boot(void *ctx,
- const struct config_update_target *target)
+ const struct config_update_target *target
+ __attribute__((__unused__)))
{
return activate_config(ctx, true);
}
diff --git a/util/seal.c b/util/seal.c
index c1182a8f..fdf5484b 100644
--- a/util/seal.c
+++ b/util/seal.c
@@ -52,7 +52,8 @@ static ssize_t seal_lget(const char *path, char label[SEAL_LABEL_LEN]);
* left alone, never labelled, followed or read as shirudo's own.
*/
static int seal_label_cb(const char *path, const struct stat *sb,
- int typeflag, struct FTW *ftwbuf)
+ int typeflag __attribute__((__unused__)),
+ struct FTW *ftwbuf __attribute__((__unused__)))
{
char label[SEAL_LABEL_LEN];
int ret;
diff --git a/util/tls_openssl.c b/util/tls_openssl.c
index b0603e57..90f448d2 100644
--- a/util/tls_openssl.c
+++ b/util/tls_openssl.c
@@ -95,7 +95,8 @@ out:
return allowed;
}
-static void tls_info_callback(const SSL *ssl, int where, int ret)
+static void tls_info_callback(const SSL *ssl, int where, int ret
+ __attribute__((__unused__)))
{
const char *group, *host;
int group_id;
diff --git a/util/upatch_decode.c b/util/upatch_decode.c
index 388680e6..ed0b6dd8 100644
--- a/util/upatch_decode.c
+++ b/util/upatch_decode.c
@@ -23,7 +23,7 @@ int upatch_decode_map_json(const struct map_view *v,
}
int upatch_decode_map_json_limit(const struct map_view *v,
- size_t max_bytes,
+ size_t max_bytes __attribute__((__unused__)),
char **out, size_t *out_len)
{
return upatch_decode_map_json(v, out, out_len);
@@ -35,22 +35,26 @@ int upatch_decode_map_otel(const struct map_view *v,
return upatch_decode_map_json(v, out, out_len);
}
-int upatch_decode_map_file_json(const char *path,
+int upatch_decode_map_file_json(const char *path
+ __attribute__((__unused__)),
const struct map_view *v,
char **out, size_t *out_len)
{
return upatch_decode_map_json(v, out, out_len);
}
-int upatch_decode_map_file_json_limit(const char *path,
+int upatch_decode_map_file_json_limit(const char *path
+ __attribute__((__unused__)),
const struct map_view *v,
- size_t max_bytes, char **out,
+ size_t max_bytes __attribute__((__unused__)),
+ char **out,
size_t *out_len)
{
return upatch_decode_map_json(v, out, out_len);
}
-int upatch_decode_map_file_otel(const char *path,
+int upatch_decode_map_file_otel(const char *path
+ __attribute__((__unused__)),
const struct map_view *v,
char **out, size_t *out_len)
{
@@ -1014,7 +1018,8 @@ static void lua_disable_globals(lua_State *L)
}
}
-static void lua_budget_hook(lua_State *L, lua_Debug *ar)
+static void lua_budget_hook(lua_State *L,
+ lua_Debug * __attribute__((__unused__)) ar)
{
struct lua_budget *budget;
diff --git a/util/upatch_maps.c b/util/upatch_maps.c
index ff30bafe..903fc50b 100644
--- a/util/upatch_maps.c
+++ b/util/upatch_maps.c
@@ -685,7 +685,7 @@ static char *format_value(const void *value, __u32 value_size,
char *upatch_map_format_percpu_sum(const struct map_view *v,
const void *values_per_cpu,
- const char *btf_type)
+ const char *btf_type __attribute__((__unused__)))
{
if (v->value_size == 1 || v->value_size == 2 ||
v->value_size == 4 || v->value_size == 8) {