test_snprintf_single.c (414B)
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (c) 2021 Google LLC. */ 3 4#include <linux/bpf.h> 5#include <bpf/bpf_helpers.h> 6 7/* The format string is filled from the userspace such that loading fails */ 8const char fmt[10]; 9 10SEC("raw_tp/sys_enter") 11int handler(const void *ctx) 12{ 13 unsigned long long arg = 42; 14 15 bpf_snprintf(NULL, 0, fmt, &arg, sizeof(arg)); 16 17 return 0; 18} 19 20char _license[] SEC("license") = "GPL";