linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <bentiss@kernel.org>
To: Jiri Kosina <jikos@kernel.org>,
	 Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Benjamin Tissoires <bentiss@kernel.org>,
	stable@vger.kernel.org
Subject: [PATCH 2/3] HID: bpf: fix return value of entrypoints_*__attach()
Date: Fri, 19 Apr 2024 16:47:52 +0200	[thread overview]
Message-ID: <20240419-hid_bpf_lazy_skel-v1-2-9210bcd4b61c@kernel.org> (raw)
In-Reply-To: <20240419-hid_bpf_lazy_skel-v1-0-9210bcd4b61c@kernel.org>

Turns out that this function returns the attached fd, so a positive
or null value.
Given that we were having no other fds before, we were receiving 0,
and the test passed.

Cc: stable@vger.kernel.org
Fixes: f5c27da4e3c8 ("HID: initial BPF implementation")
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
---
 drivers/hid/bpf/hid_bpf_jmp_table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/bpf/hid_bpf_jmp_table.c b/drivers/hid/bpf/hid_bpf_jmp_table.c
index 89496aabbe15..301ac79db241 100644
--- a/drivers/hid/bpf/hid_bpf_jmp_table.c
+++ b/drivers/hid/bpf/hid_bpf_jmp_table.c
@@ -521,7 +521,7 @@ void hid_bpf_free_links_and_skel(void)
 
 #define ATTACH_AND_STORE_LINK(__name) do {					\
 	err = entrypoints_bpf__##__name##__attach(skel);			\
-	if (err)								\
+	if (err < 0)								\
 		goto out;							\
 										\
 	links[idx] = bpf_link_get_from_fd(skel->links.__name##_fd);		\

-- 
2.44.0


  parent reply	other threads:[~2024-04-19 14:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19 14:47 [PATCH 0/3] HID: bpf: some fixes for pre-loading HID-BPF Benjamin Tissoires
2024-04-19 14:47 ` [PATCH 1/3] HID: bpf: fix a comment in a define Benjamin Tissoires
2024-04-19 14:47 ` Benjamin Tissoires [this message]
2024-04-19 14:47 ` [PATCH 3/3] HID: bpf: lazy load the hid_tail_call entrypoint Benjamin Tissoires
2024-04-23  7:10   ` Dan Carpenter
2024-04-24 14:17     ` Benjamin Tissoires
2024-04-25 12:52       ` Benjamin Tissoires

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240419-hid_bpf_lazy_skel-v1-2-9210bcd4b61c@kernel.org \
    --to=bentiss@kernel.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).