Commit a42effb0 authored by Dave Marchevsky's avatar Dave Marchevsky Committed by Alexei Starovoitov
Browse files

bpf: Clarify data_len param in bpf_snprintf and bpf_seq_printf comments



Since the data_len in these two functions is a byte len of the preceding
u64 *data array, it must always be a multiple of 8. If this isn't the
case both helpers error out, so let's make the requirement explicit so
users don't need to infer it.

Signed-off-by: default avatarDave Marchevsky <davemarchevsky@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210917182911.2426606-10-davemarchevsky@fb.com
parent 7606729f
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -4046,7 +4046,7 @@ union bpf_attr {
 * 		arguments. The *data* are a **u64** array and corresponding format string
 * 		arguments. The *data* are a **u64** array and corresponding format string
 * 		values are stored in the array. For strings and pointers where pointees
 * 		values are stored in the array. For strings and pointers where pointees
 * 		are accessed, only the pointer values are stored in the *data* array.
 * 		are accessed, only the pointer values are stored in the *data* array.
 * 		The *data_len* is the size of *data* in bytes.
 * 		The *data_len* is the size of *data* in bytes - must be a multiple of 8.
 *
 *
 *		Formats **%s**, **%p{i,I}{4,6}** requires to read kernel memory.
 *		Formats **%s**, **%p{i,I}{4,6}** requires to read kernel memory.
 *		Reading kernel memory may fail due to either invalid address or
 *		Reading kernel memory may fail due to either invalid address or
@@ -4751,7 +4751,8 @@ union bpf_attr {
 *		Each format specifier in **fmt** corresponds to one u64 element
 *		Each format specifier in **fmt** corresponds to one u64 element
 *		in the **data** array. For strings and pointers where pointees
 *		in the **data** array. For strings and pointers where pointees
 *		are accessed, only the pointer values are stored in the *data*
 *		are accessed, only the pointer values are stored in the *data*
 *		array. The *data_len* is the size of *data* in bytes.
 *		array. The *data_len* is the size of *data* in bytes - must be
 *		a multiple of 8.
 *
 *
 *		Formats **%s** and **%p{i,I}{4,6}** require to read kernel
 *		Formats **%s** and **%p{i,I}{4,6}** require to read kernel
 *		memory. Reading kernel memory may fail due to either invalid
 *		memory. Reading kernel memory may fail due to either invalid
+3 −2
Original line number Original line Diff line number Diff line
@@ -4046,7 +4046,7 @@ union bpf_attr {
 * 		arguments. The *data* are a **u64** array and corresponding format string
 * 		arguments. The *data* are a **u64** array and corresponding format string
 * 		values are stored in the array. For strings and pointers where pointees
 * 		values are stored in the array. For strings and pointers where pointees
 * 		are accessed, only the pointer values are stored in the *data* array.
 * 		are accessed, only the pointer values are stored in the *data* array.
 * 		The *data_len* is the size of *data* in bytes.
 * 		The *data_len* is the size of *data* in bytes - must be a multiple of 8.
 *
 *
 *		Formats **%s**, **%p{i,I}{4,6}** requires to read kernel memory.
 *		Formats **%s**, **%p{i,I}{4,6}** requires to read kernel memory.
 *		Reading kernel memory may fail due to either invalid address or
 *		Reading kernel memory may fail due to either invalid address or
@@ -4751,7 +4751,8 @@ union bpf_attr {
 *		Each format specifier in **fmt** corresponds to one u64 element
 *		Each format specifier in **fmt** corresponds to one u64 element
 *		in the **data** array. For strings and pointers where pointees
 *		in the **data** array. For strings and pointers where pointees
 *		are accessed, only the pointer values are stored in the *data*
 *		are accessed, only the pointer values are stored in the *data*
 *		array. The *data_len* is the size of *data* in bytes.
 *		array. The *data_len* is the size of *data* in bytes - must be
 *		a multiple of 8.
 *
 *
 *		Formats **%s** and **%p{i,I}{4,6}** require to read kernel
 *		Formats **%s** and **%p{i,I}{4,6}** require to read kernel
 *		memory. Reading kernel memory may fail due to either invalid
 *		memory. Reading kernel memory may fail due to either invalid