The struct uinput_dev variable is on stack, so clear its content to avoid accidentally writing garbage values to kernel. This fixes "Can't create uinput device: Invalid argument (22)" in some cases. Signed-off-by: Haochen Tong <i@xxxxxxxxxxxx> --- profiles/audio/avctp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c index d3b5dfab9..f7a3de211 100644 --- a/profiles/audio/avctp.c +++ b/profiles/audio/avctp.c @@ -1182,6 +1182,8 @@ static int uinput_create(struct btd_device *device, const char *name, } } + memset(&dev, 0, sizeof(struct uinput_dev)); + if (name) { strncpy(dev.name, name, UINPUT_MAX_NAME_SIZE); dev.name[UINPUT_MAX_NAME_SIZE - 1] = '\0'; base-commit: b4270d79e19ee70ccab6c087a7b470dad8a8a8bf -- 2.24.1