summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorFlorent Revest <revest@chromium.org>2021-05-17 11:28:29 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2021-05-20 23:48:38 +0200
commit8afcc19fbf083a8459284d9a29b4b5ac1cb2396c (patch)
tree227e0fc424d5b62d3072c3da5f35b0bf67b8fce9 /kernel
parent704e2beba23c45eaa056b1c03b5e1fb221e03f80 (diff)
downloadlinux-8afcc19fbf083a8459284d9a29b4b5ac1cb2396c.tar.bz2
bpf: Clarify a bpf_bprintf_prepare macro
The per-cpu buffers contain bprintf data rather than printf arguments. The macro name and comment were a bit confusing, this rewords them in a clearer way. Signed-off-by: Florent Revest <revest@chromium.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/bpf/20210517092830.1026418-1-revest@chromium.org
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/helpers.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index ef658a9ea5c9..3a5ab614cbb0 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -692,13 +692,14 @@ static int bpf_trace_copy_string(char *buf, void *unsafe_ptr, char fmt_ptype,
return -EINVAL;
}
-/* Per-cpu temp buffers which can be used by printf-like helpers for %s or %p
+/* Per-cpu temp buffers used by printf-like helpers to store the bprintf binary
+ * arguments representation.
*/
-#define MAX_PRINTF_BUF_LEN 512
+#define MAX_BPRINTF_BUF_LEN 512
/* Support executing three nested bprintf helper calls on a given CPU */
struct bpf_bprintf_buffers {
- char tmp_bufs[3][MAX_PRINTF_BUF_LEN];
+ char tmp_bufs[3][MAX_BPRINTF_BUF_LEN];
};
static DEFINE_PER_CPU(struct bpf_bprintf_buffers, bpf_bprintf_bufs);
static DEFINE_PER_CPU(int, bpf_bprintf_nest_level);
@@ -761,7 +762,7 @@ int bpf_bprintf_prepare(char *fmt, u32 fmt_size, const u64 *raw_args,
if (num_args && try_get_fmt_tmp_buf(&tmp_buf))
return -EBUSY;
- tmp_buf_end = tmp_buf + MAX_PRINTF_BUF_LEN;
+ tmp_buf_end = tmp_buf + MAX_BPRINTF_BUF_LEN;
*bin_args = (u32 *)tmp_buf;
}