[bug report] selftests/hid: add tests for bpf_hid_hw_request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ 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




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux