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: 20915 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp69858wru; Wed, 16 Nov 2022 02:44:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf6GNtVx2YGLCbXk5IHnFm6AblaB+wcCstOSKZgA04+UU/pwT7VkL+2LDpO+Df5awueuiIeQ X-Received: by 2002:a63:1a24:0:b0:470:60a5:2f70 with SMTP id a36-20020a631a24000000b0047060a52f70mr20318923pga.99.1668595492136; Wed, 16 Nov 2022 02:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668595492; cv=none; d=google.com; s=arc-20160816; b=eCl3sR3iOGmo8+c3nIrxfw2WrRhyFAQ1hv6kc3Cf58DXvkZhywyRiAOo320eHKWmr8 1KRr3u8NE3ptYncQ5Ftn9J2MiCUHjyvLnC+lcaRpbM2dhoKfBPJtJ/XS6yPhTWGq8OuG rgw4udljq+EuDvKBstMrCk7vokozTcnMKQYlw2/r/+toj7rCDSUrTspw+Hp5Dmx3CDzg QGJHoLq1Cet6sANyDhbHAApyVjZjkco3TybWzEKMtbtwSdx9TkuLqPZKmGlUbeWi8vkd ZqITWbh/EV4XUYcdzc8K4JdD3JZx/HqUkWzU+scA8Az2zaDApSxoVn0E9fAiQktppIfy Pp7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KMf1wj6uhiThKc0LO2n9P1YxDQHLdC8FGGp8WLlmHBQ=; b=Tnk5IoIDhwOIHsDAFQdU97ojNsJm7ui8r8lO2rktPViW0ELClG67AWcdLT7tJqGQwh 4qIu/dqBfjsEMcd4qPVoclhtBlmdT+a1MrHKWtwVERLJ7A9oNyrdhdK56XzhDcsX7Icj PqHphNtyaJ+aTzDNm1BKt3UADfyqwQjI0xmNtLQbTHxy8LmOhrdKqQ2skr9akNQ4ED9J DVQ3NAbYFWSkpx4zGaF1fyyPVx+ujsMHkPHj82B5FxP3mDvDGu+BQ5jmRWDxc4nbqQ/J oO88gXUzgZ1bUEuU/yeFAGJSLOk3gq+E37Rx53PRM4RNBc3M9jGk8+R88EZmlkzwyXfV 9K8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=by60+Rut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020a056a000ac100b0056381876081si12580928pfl.328.2022.11.16.02.44.39; Wed, 16 Nov 2022 02:44:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=by60+Rut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238744AbiKPKoc (ORCPT + 99 others); Wed, 16 Nov 2022 05:44:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233819AbiKPKoO (ORCPT ); Wed, 16 Nov 2022 05:44:14 -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 9750C2AEA for ; Wed, 16 Nov 2022 02:31:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668594680; 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=by60+Rutuomb40P5INSp5CVUrf5x4FAjz27tz+NpBEr0wFhYNpN8bsikay0Qh7+BK3MogA EwK/zCHLO/RrmCz+hRIpfaxoU+KDXxm5Wk15VEXx7PbwhlrV2+Na+DRA4p/PogvjTLIHkv GdrlMUOhPbLUByJtRrig27OC1gOZyio= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749649186600589356?= X-GMAIL-MSGID: =?utf-8?q?1749649186600589356?= 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) {}