From patchwork Wed Nov 16 10:31:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 625320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31C2FC43219 for ; Wed, 16 Nov 2022 10:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232775AbiKPKoe (ORCPT ); Wed, 16 Nov 2022 05:44:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237241AbiKPKoQ (ORCPT ); Wed, 16 Nov 2022 05:44:16 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7159A2126B for ; Wed, 16 Nov 2022 02:31:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668594681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=KMf1wj6uhiThKc0LO2n9P1YxDQHLdC8FGGp8WLlmHBQ=; b=ZJiPzY/dWvZyen7YlYWlGaUWeBTgeb2zsinMftRar08E27Ue58wcvbd4wUDokAOlJIJm0H sPuejy8amORkgNnOgreSlsWKh8SjBOSAurg3tzWwYmofa5ZcTPwaFkO8oJvABfBqaZp7SM NdjtrwENrhVYc0t6TkHMXLQnvCb0q54= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-7SY8pOamOjCEh56wKFscnQ-1; Wed, 16 Nov 2022 05:31:17 -0500 X-MC-Unique: 7SY8pOamOjCEh56wKFscnQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 49D5A1C09B8D; Wed, 16 Nov 2022 10:31:15 +0000 (UTC) Received: from plouf.redhat.com (unknown [10.39.194.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7063240C83AA; Wed, 16 Nov 2022 10:31:14 +0000 (UTC) From: Benjamin Tissoires To: Jiri Kosina Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires Subject: [PATCH] HID: bpf: return non NULL data pointer when CONFIG_HID_BPF is not set Date: Wed, 16 Nov 2022 11:31:10 +0100 Message-Id: <20221116103110.1746497-1-benjamin.tissoires@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org dispatch_hid_bpf_device_event() is supposed to return either an error, or a valid pointer to memory containing the data. Returning NULL simply makes a segfault when CONFIG_HID_BPF is not set for any processed event. Signed-off-by: Benjamin Tissoires --- This was detected by my own CI. Yes, a little bit embarrassing... It applies on top of for-6.2/hid-bpf in case it was not obvious Cheers, Benjamin --- include/linux/hid_bpf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h index 9b11f8f25ad5..3ca85ab91325 100644 --- a/include/linux/hid_bpf.h +++ b/include/linux/hid_bpf.h @@ -148,7 +148,7 @@ void hid_bpf_device_init(struct hid_device *hid); u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *size); #else /* CONFIG_HID_BPF */ static inline u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type, - u8 *data, u32 *size, int interrupt) { return NULL; } + u8 *data, u32 *size, int interrupt) { return data; } static inline int hid_bpf_connect_device(struct hid_device *hdev) { return 0; } static inline void hid_bpf_disconnect_device(struct hid_device *hdev) {} static inline void hid_bpf_destroy_device(struct hid_device *hid) {}