Skip to content
Commit 3bda08b6 authored by Daniel Rosenberg's avatar Daniel Rosenberg Committed by Alexei Starovoitov
Browse files

bpf: Allow NULL buffers in bpf_dynptr_slice(_rw)



bpf_dynptr_slice(_rw) uses a user provided buffer if it can not provide
a pointer to a block of contiguous memory. This buffer is unused in the
case of local dynptrs, and may be unused in other cases as well. There
is no need to require the buffer, as the kfunc can just return NULL if
it was needed and not provided.

This adds another kfunc annotation, __opt, which combines with __sz and
__szk to allow the buffer associated with the size to be NULL. If the
buffer is NULL, the verifier does not check that the buffer is of
sufficient size.

Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
Link: https://lore.kernel.org/r/20230506013134.2492210-2-drosen@google.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent e04ddf17
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment