Commit 08a6f22e authored by Matt Smith's avatar Matt Smith Committed by Andrii Nakryiko
Browse files

libbpf: Change bpf_object_skeleton data field to const pointer



This change was necessary to enforce the implied contract
that bpf_object_skeleton->data should not be mutated.  The data
will be cast to `void *` during assignment to handle the case
where a user is compiling with older libbpf headers to avoid
a compiler warning of `const void *` data being cast to `void *`

Signed-off-by: default avatarMatt Smith <alastorze@fb.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210901194439.3853238-2-alastorze@fb.com
parent 03e601f4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -854,7 +854,7 @@ struct bpf_object_skeleton {
	size_t sz; /* size of this struct, for forward/backward compatibility */

	const char *name;
	void *data;
	const void *data;
	size_t data_sz;

	struct bpf_object **obj;