Linux Input/HID development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org
Subject: [bug report] selftests/hid: add tests for bpf_hid_hw_request
Date: Thu, 5 Sep 2024 09:17:33 +0300	[thread overview]
Message-ID: <a8082ffb-68f7-425b-a3f8-f9f14dbf2a92@stanley.mountain> (raw)

[ Moving these functions around made them show up as new warnings. ]

Hello Benjamin Tissoires,

Commit 4f7153cf461e ("selftests/hid: add tests for
bpf_hid_hw_request") from Nov 3, 2022 (linux-next), leads to the
following Smatch static checker warning:

	tools/testing/selftests/hid/hid_common.h:212 uhid_event()
	warn: assigning (-5) to unsigned variable 'answer.u.get_report_reply.err'

tools/testing/selftests/hid/hid_common.h
    207         case UHID_GET_REPORT:
    208                 UHID_LOG("UHID_GET_REPORT from uhid-dev");
    209 
    210                 answer.type = UHID_GET_REPORT_REPLY;
    211                 answer.u.get_report_reply.id = ev.u.get_report.id;
--> 212                 answer.u.get_report_reply.err = ev.u.get_report.rnum == 1 ? 0 : -EIO;

answer.u.get_report_reply.err is a u16.  I couldn't figure out which kind of
error codes it's supposed to store or how they're used...

    213                 answer.u.get_report_reply.size = sizeof(feature_data);
    214                 memcpy(answer.u.get_report_reply.data, feature_data, sizeof(feature_data));
    215 
    216                 uhid_write(_metadata, fd, &answer);
    217 
    218                 break;
    219         case UHID_SET_REPORT:
    220                 UHID_LOG("UHID_SET_REPORT from uhid-dev");
    221                 break;
    222         default:

regards,
dan carpenter

             reply	other threads:[~2024-09-05  6:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05  6:17 Dan Carpenter [this message]
2024-09-05 12:45 ` [bug report] selftests/hid: add tests for bpf_hid_hw_request Benjamin Tissoires
  -- strict thread matches above, loose matches on Subject: below --
2023-06-06  8:31 Dan Carpenter

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=a8082ffb-68f7-425b-a3f8-f9f14dbf2a92@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=bentiss@kernel.org \
    --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