From: Dan Carpenter <dan.carpenter@linaro.org>
To: benjamin.tissoires@redhat.com
Cc: linux-input@vger.kernel.org
Subject: [bug report] selftests/hid: add tests for bpf_hid_hw_request
Date: Tue, 6 Jun 2023 11:31:28 +0300 [thread overview]
Message-ID: <ZH7u4NDGLcqfCrTk@moroto> (raw)
Hello Benjamin Tissoires,
The patch 4f7153cf461e: "selftests/hid: add tests for
bpf_hid_hw_request" from Nov 3, 2022, leads to the following Smatch
static checker warning:
./tools/testing/selftests/hid/hid_bpf.c:214 uhid_event()
warn: assigning (-5) to unsigned variable 'answer.u.get_report_reply.err'
./tools/testing/selftests/hid/hid_bpf.c
203 case UHID_CLOSE:
204 UHID_LOG("UHID_CLOSE from uhid-dev");
205 break;
206 case UHID_OUTPUT:
207 UHID_LOG("UHID_OUTPUT from uhid-dev");
208 break;
209 case UHID_GET_REPORT:
210 UHID_LOG("UHID_GET_REPORT from uhid-dev");
211
212 answer.type = UHID_GET_REPORT_REPLY;
213 answer.u.get_report_reply.id = ev.u.get_report.id;
--> 214 answer.u.get_report_reply.err = ev.u.get_report.rnum == 1 ? 0 : -EIO;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is a u16 so it can't hold negative error codes.
215 answer.u.get_report_reply.size = sizeof(feature_data);
216 memcpy(answer.u.get_report_reply.data, feature_data, sizeof(feature_data));
217
218 uhid_write(_metadata, fd, &answer);
219
220 break;
221 case UHID_SET_REPORT:
222 UHID_LOG("UHID_SET_REPORT from uhid-dev");
223 break;
224 default:
regards,
dan carpenter
next reply other threads:[~2023-06-06 8:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 8:31 Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-09-05 6:17 [bug report] selftests/hid: add tests for bpf_hid_hw_request Dan Carpenter
2024-09-05 12:45 ` 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=ZH7u4NDGLcqfCrTk@moroto \
--to=dan.carpenter@linaro.org \
--cc=benjamin.tissoires@redhat.com \
--cc=linux-input@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