Re: [PATCH bpf-next v1 1/6] HID: initial BPF implementation
From: Benjamin Tissoires <hidden>
Date: 2022-02-24 13:53:16
Also in:
bpf, linux-input, linux-kselftest, lkml
From: Benjamin Tissoires <hidden>
Date: 2022-02-24 13:53:16
Also in:
bpf, linux-input, linux-kselftest, lkml
On Thu, Feb 24, 2022 at 12:41 PM Greg KH [off-list ref] wrote:
On Thu, Feb 24, 2022 at 12:08:23PM +0100, Benjamin Tissoires wrote:quoted
index 000000000000..243ac45a253f--- /dev/null +++ b/include/uapi/linux/bpf_hid.h@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */ + +/* + * HID BPF public headers + * + * Copyright (c) 2021 Benjamin Tissoires + */ + +#ifndef _UAPI__LINUX_BPF_HID_H__ +#define _UAPI__LINUX_BPF_HID_H__ + +#include <linux/types.h> + +#define HID_BPF_MAX_BUFFER_SIZE 16384 /* 16kb */ + +struct hid_device; + +enum hid_bpf_event { + HID_BPF_UNDEF = 0, + HID_BPF_DEVICE_EVENT, +}; + +/* type is HID_BPF_DEVICE_EVENT */ +struct hid_bpf_ctx_device_event { + __u8 data[HID_BPF_MAX_BUFFER_SIZE]; + unsigned long size;That's not a valid type to cross the user/kernel boundry, shouldn't it be "__u64"? But really, isn't __u32 enough here?
thanks. Even __u16 should be enough, given that the upper bound is 16384. I'll amend it in v2. Cheers, Benjamin
thanks, greg k-h