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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri,  8 Oct 2021 14:49:55 +0200 Lorenzo Bianconi wrote:
> +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?

> +	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;
> +}



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux