Thread (24 messages) 24 messages, 3 authors, 2021-10-11

Re: [PATCH v15 bpf-next 17/18] net: xdp: introduce bpf_xdp_pointer utility routine

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-10-09 01:10:29
Also in: bpf

On Fri,  8 Oct 2021 14:49:55 +0200 Lorenzo Bianconi wrote:
quoted hunk ↗ jump to hunk
+BPF_CALL_4(bpf_xdp_load_bytes, struct xdp_buff *, xdp, u32, offset,
+	   void *, buf, u32, len)
+{
+	void *ptr;
+
+	if (!buf)
+		return -EINVAL;
Can we make the verifier ensure it's not NULL?
quoted hunk ↗ jump to hunk
+	ptr = bpf_xdp_pointer(xdp, offset, len, buf);
+	if (ptr != buf)
+		memcpy(buf, ptr, len);
Don't we need to return an error in case offset + length > frame size?
+	return 0;
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help