* Re: [PATCH 08/12] HID: core: for input reports, process the usages by priority list
@ 2022-01-28 13:52 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-28 13:52 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 19756 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220126161832.3193805-9-benjamin.tissoires@redhat.com>
References: <20220126161832.3193805-9-benjamin.tissoires@redhat.com>
TO: Benjamin Tissoires <benjamin.tissoires@redhat.com>
TO: Jiri Kosina <jikos@kernel.org>
TO: Dmitry Torokhov <dmitry.torokhov@gmail.com>
TO: Jonathan Corbet <corbet@lwn.net>
TO: "Ahelenia Ziemiańska" <nabijaczleweli@nabijaczleweli.xyz>
TO: Ping Cheng <pinglinux@gmail.com>
TO: Aaron Armstrong Skomra <skomra@gmail.com>
TO: Jason Gerecke <killertofu@gmail.com>
TO: Peter Hutterer <peter.hutterer@who-t.net>
CC: linux-input(a)vger.kernel.org
CC: linux-doc(a)vger.kernel.org
Hi Benjamin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on hid/for-next]
[also build test WARNING on v5.17-rc1 next-20220127]
[cannot apply to jikos-hid/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Benjamin-Tissoires/HID-fix-for-generic-input-processing/20220127-002107
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: riscv-randconfig-c006-20220124 (https://download.01.org/0day-ci/archive/20220128/202201282135.fedFj5tc-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2a1b7aa016c0f4b5598806205bdfbab1ea2d92c4)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/5f297c23cba491924689834a01ef511263c9e547
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Benjamin-Tissoires/HID-fix-for-generic-input-processing/20220127-002107
git checkout 5f297c23cba491924689834a01ef511263c9e547
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:2353:2: note: Taking false branch
if (hdev->ll_driver->request)
^
drivers/hid/hid-core.c:2356:2: note: Calling '__hid_request'
__hid_request(hdev, report, reqtype);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1931:6: note: Assuming 'buf' is non-null
if (!buf)
^~~~
drivers/hid/hid-core.c:1931:2: note: Taking false branch
if (!buf)
^
drivers/hid/hid-core.c:1936:6: note: Assuming 'reqtype' is equal to HID_REQ_SET_REPORT
if (reqtype == HID_REQ_SET_REPORT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1936:2: note: Taking true branch
if (reqtype == HID_REQ_SET_REPORT)
^
drivers/hid/hid-core.c:1937:3: note: Calling 'hid_output_report'
hid_output_report(report, buf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1844:14: note: Field 'id' is <= 0
if (report->id > 0)
^
drivers/hid/hid-core.c:1844:2: note: Taking false branch
if (report->id > 0)
^
drivers/hid/hid-core.c:1848:14: note: Assuming 'n' is < field 'maxfield'
for (n = 0; n < report->maxfield; n++)
^~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1848:2: note: Loop condition is true. Entering loop body
for (n = 0; n < report->maxfield; n++)
^
drivers/hid/hid-core.c:1849:3: note: Calling 'hid_output_field'
hid_output_field(report->device, report->field[n], data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1811:2: note: 'size' initialized here
unsigned size = field->report_size;
^~~~~~~~~~~~~
drivers/hid/hid-core.c:1814:14: note: Assuming 'n' is < 'count'
for (n = 0; n < count; n++) {
^~~~~~~~~
drivers/hid/hid-core.c:1814:2: note: Loop condition is true. Entering loop body
for (n = 0; n < count; n++) {
^
drivers/hid/hid-core.c:1815:7: note: Assuming field 'logical_minimum' is < 0
if (field->logical_minimum < 0) /* signed values */
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1815:3: note: Taking true branch
if (field->logical_minimum < 0) /* signed values */
^
drivers/hid/hid-core.c:1816:4: note: Calling 'implement'
implement(hid, data, offset + n * size, size,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1426:15: note: Assuming 'n' is <= 32
if (unlikely(n > 32)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
drivers/hid/hid-core.c:1426:2: note: Taking false branch
if (unlikely(n > 32)) {
^
drivers/hid/hid-core.c:1430:13: note: Assuming 'n' is >= 32
} else if (n < 32) {
^~~~~~
drivers/hid/hid-core.c:1430:9: note: Taking false branch
} else if (n < 32) {
^
drivers/hid/hid-core.c:1816:4: note: Returning from 'implement'
implement(hid, data, offset + n * size, size,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1814:14: note: Assuming 'n' is < 'count'
for (n = 0; n < count; n++) {
^~~~~~~~~
drivers/hid/hid-core.c:1814:2: note: Loop condition is true. Entering loop body
for (n = 0; n < count; n++) {
^
drivers/hid/hid-core.c:1815:14: note: Field 'logical_minimum' is < 0
if (field->logical_minimum < 0) /* signed values */
^
drivers/hid/hid-core.c:1815:3: note: Taking true branch
if (field->logical_minimum < 0) /* signed values */
^
drivers/hid/hid-core.c:1817:31: note: Passing the value 32 via 2nd parameter 'n'
s32ton(field->value[n], size));
^~~~
drivers/hid/hid-core.c:1817:7: note: Calling 's32ton'
s32ton(field->value[n], size));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1339:6: note: Assuming 'a' is 0
if (a && a != -1)
^
drivers/hid/hid-core.c:1339:8: note: Left side of '&&' is false
if (a && a != -1)
^
drivers/hid/hid-core.c:1341:21: note: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'int'
return value & ((1 << n) - 1);
^ ~
>> drivers/hid/hid-core.c:1665:30: warning: Although the value stored to 'field' is used in the enclosing expression, the value is never actually read from 'field' [clang-analyzer-deadcode.DeadStores]
hid_input_fetch_field(hid, field = report->field[a], data);
^ ~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1665:30: note: Although the value stored to 'field' is used in the enclosing expression, the value is never actually read from 'field'
hid_input_fetch_field(hid, field = report->field[a], data);
^ ~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:2198:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores]
len += sprintf(buf + len, "%shidraw%d", len ? "," : "",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:2198:3: note: Value stored to 'len' is never read
len += sprintf(buf + len, "%shidraw%d", len ? "," : "",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (4 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (4 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
38 warnings generated.
drivers/iio/humidity/hts221_core.c:183:13: warning: The result of the left shift is undefined due to shifting '2' by '31', which is unrepresentable in the unsigned version of the return type 'int' [clang-analyzer-core.UndefinedBinaryOperatorResult]
data = ((i << __ffs(avg->mask)) & avg->mask);
^
drivers/iio/humidity/hts221_core.c:486:6: note: Assuming 'ret' is 0
if (ret)
^~~
drivers/iio/humidity/hts221_core.c:486:2: note: Taking false branch
if (ret)
^
drivers/iio/humidity/hts221_core.c:489:2: note: Control jumps to 'case IIO_CHAN_INFO_OVERSAMPLING_RATIO:' at line 493
switch (mask) {
^
drivers/iio/humidity/hts221_core.c:494:3: note: Control jumps to 'case IIO_TEMP:' at line 498
switch (chan->type) {
^
drivers/iio/humidity/hts221_core.c:499:10: note: Calling 'hts221_update_avg'
ret = hts221_update_avg(hw, HTS221_SENSOR_T, val);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/humidity/hts221_core.c:176:2: note: Loop condition is true. Entering loop body
for (i = 0; i < HTS221_AVG_DEPTH; i++)
^
drivers/iio/humidity/hts221_core.c:177:7: note: Assuming the condition is false
if (avg->avg_avl[i] == val)
vim +1665 drivers/hid/hid-core.c
dde5845a529ff7 Jiri Kosina 2006-12-08 1648
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1649 /*
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1650 * Analyse a received report, and fetch the data from it. The field
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1651 * content is stored for next report processing (we do differential
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1652 * reporting to the layer).
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1653 */
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1654 static void hid_process_report(struct hid_device *hid,
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1655 struct hid_report *report,
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1656 __u8 *data,
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1657 int interrupt)
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1658 {
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1659 unsigned int a;
5f297c23cba491 Benjamin Tissoires 2022-01-26 1660 struct hid_field_entry *entry;
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1661 struct hid_field *field;
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1662
5f297c23cba491 Benjamin Tissoires 2022-01-26 1663 /* first retrieve all incoming values in data */
5f297c23cba491 Benjamin Tissoires 2022-01-26 1664 for (a = 0; a < report->maxfield; a++)
5f297c23cba491 Benjamin Tissoires 2022-01-26 @1665 hid_input_fetch_field(hid, field = report->field[a], data);
5f297c23cba491 Benjamin Tissoires 2022-01-26 1666
5f297c23cba491 Benjamin Tissoires 2022-01-26 1667 if (!list_empty(&report->field_entry_list)) {
5f297c23cba491 Benjamin Tissoires 2022-01-26 1668 /* INPUT_REPORT, we have a priority list of fields */
5f297c23cba491 Benjamin Tissoires 2022-01-26 1669 list_for_each_entry(entry,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1670 &report->field_entry_list,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1671 list) {
5f297c23cba491 Benjamin Tissoires 2022-01-26 1672 field = entry->field;
5f297c23cba491 Benjamin Tissoires 2022-01-26 1673
5f297c23cba491 Benjamin Tissoires 2022-01-26 1674 if (field->flags & HID_MAIN_ITEM_VARIABLE)
5f297c23cba491 Benjamin Tissoires 2022-01-26 1675 hid_process_event(hid,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1676 field,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1677 &field->usage[entry->index],
5f297c23cba491 Benjamin Tissoires 2022-01-26 1678 field->new_value[entry->index],
5f297c23cba491 Benjamin Tissoires 2022-01-26 1679 interrupt);
5f297c23cba491 Benjamin Tissoires 2022-01-26 1680 else
5f297c23cba491 Benjamin Tissoires 2022-01-26 1681 hid_input_array_field(hid, field, interrupt);
5f297c23cba491 Benjamin Tissoires 2022-01-26 1682 }
5f297c23cba491 Benjamin Tissoires 2022-01-26 1683
5f297c23cba491 Benjamin Tissoires 2022-01-26 1684 /* we need to do the memcpy at the end for var items */
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1685 for (a = 0; a < report->maxfield; a++) {
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1686 field = report->field[a];
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1687
5f297c23cba491 Benjamin Tissoires 2022-01-26 1688 if (field->flags & HID_MAIN_ITEM_VARIABLE)
5f297c23cba491 Benjamin Tissoires 2022-01-26 1689 memcpy(field->value, field->new_value,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1690 field->report_count * sizeof(__s32));
5f297c23cba491 Benjamin Tissoires 2022-01-26 1691 }
5f297c23cba491 Benjamin Tissoires 2022-01-26 1692 } else {
5f297c23cba491 Benjamin Tissoires 2022-01-26 1693 /* FEATURE_REPORT, regular processing */
5f297c23cba491 Benjamin Tissoires 2022-01-26 1694 for (a = 0; a < report->maxfield; a++) {
5f297c23cba491 Benjamin Tissoires 2022-01-26 1695 field = report->field[a];
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1696
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1697 if (field->flags & HID_MAIN_ITEM_VARIABLE)
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1698 hid_input_var_field(hid, field, interrupt);
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1699 else
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1700 hid_input_array_field(hid, field, interrupt);
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1701 }
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1702 }
5f297c23cba491 Benjamin Tissoires 2022-01-26 1703 }
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1704
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 08/12] HID: core: for input reports, process the usages by priority list
@ 2022-01-29 21:57 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-29 21:57 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 18655 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220126161832.3193805-9-benjamin.tissoires@redhat.com>
References: <20220126161832.3193805-9-benjamin.tissoires@redhat.com>
TO: Benjamin Tissoires <benjamin.tissoires@redhat.com>
TO: Jiri Kosina <jikos@kernel.org>
TO: Dmitry Torokhov <dmitry.torokhov@gmail.com>
TO: Jonathan Corbet <corbet@lwn.net>
TO: "Ahelenia Ziemiańska" <nabijaczleweli@nabijaczleweli.xyz>
TO: Ping Cheng <pinglinux@gmail.com>
TO: Aaron Armstrong Skomra <skomra@gmail.com>
TO: Jason Gerecke <killertofu@gmail.com>
TO: Peter Hutterer <peter.hutterer@who-t.net>
CC: linux-input(a)vger.kernel.org
CC: linux-doc(a)vger.kernel.org
Hi Benjamin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on hid/for-next]
[also build test WARNING on v5.17-rc1 next-20220128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Benjamin-Tissoires/HID-fix-for-generic-input-processing/20220127-002107
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: riscv-randconfig-c006-20220124 (https://download.01.org/0day-ci/archive/20220130/202201300505.1LcHvClV-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2a1b7aa016c0f4b5598806205bdfbab1ea2d92c4)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/5f297c23cba491924689834a01ef511263c9e547
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Benjamin-Tissoires/HID-fix-for-generic-input-processing/20220127-002107
git checkout 5f297c23cba491924689834a01ef511263c9e547
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:2353:2: note: Taking false branch
if (hdev->ll_driver->request)
^
drivers/hid/hid-core.c:2356:2: note: Calling '__hid_request'
__hid_request(hdev, report, reqtype);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1931:6: note: Assuming 'buf' is non-null
if (!buf)
^~~~
drivers/hid/hid-core.c:1931:2: note: Taking false branch
if (!buf)
^
drivers/hid/hid-core.c:1936:6: note: Assuming 'reqtype' is equal to HID_REQ_SET_REPORT
if (reqtype == HID_REQ_SET_REPORT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1936:2: note: Taking true branch
if (reqtype == HID_REQ_SET_REPORT)
^
drivers/hid/hid-core.c:1937:3: note: Calling 'hid_output_report'
hid_output_report(report, buf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1844:14: note: Field 'id' is <= 0
if (report->id > 0)
^
drivers/hid/hid-core.c:1844:2: note: Taking false branch
if (report->id > 0)
^
drivers/hid/hid-core.c:1848:14: note: Assuming 'n' is < field 'maxfield'
for (n = 0; n < report->maxfield; n++)
^~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1848:2: note: Loop condition is true. Entering loop body
for (n = 0; n < report->maxfield; n++)
^
drivers/hid/hid-core.c:1849:3: note: Calling 'hid_output_field'
hid_output_field(report->device, report->field[n], data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1811:2: note: 'size' initialized here
unsigned size = field->report_size;
^~~~~~~~~~~~~
drivers/hid/hid-core.c:1814:14: note: Assuming 'n' is < 'count'
for (n = 0; n < count; n++) {
^~~~~~~~~
drivers/hid/hid-core.c:1814:2: note: Loop condition is true. Entering loop body
for (n = 0; n < count; n++) {
^
drivers/hid/hid-core.c:1815:7: note: Assuming field 'logical_minimum' is < 0
if (field->logical_minimum < 0) /* signed values */
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1815:3: note: Taking true branch
if (field->logical_minimum < 0) /* signed values */
^
drivers/hid/hid-core.c:1816:4: note: Calling 'implement'
implement(hid, data, offset + n * size, size,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1426:15: note: Assuming 'n' is <= 32
if (unlikely(n > 32)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
drivers/hid/hid-core.c:1426:2: note: Taking false branch
if (unlikely(n > 32)) {
^
drivers/hid/hid-core.c:1430:13: note: Assuming 'n' is >= 32
} else if (n < 32) {
^~~~~~
drivers/hid/hid-core.c:1430:9: note: Taking false branch
} else if (n < 32) {
^
drivers/hid/hid-core.c:1816:4: note: Returning from 'implement'
implement(hid, data, offset + n * size, size,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1814:14: note: Assuming 'n' is < 'count'
for (n = 0; n < count; n++) {
^~~~~~~~~
drivers/hid/hid-core.c:1814:2: note: Loop condition is true. Entering loop body
for (n = 0; n < count; n++) {
^
drivers/hid/hid-core.c:1815:14: note: Field 'logical_minimum' is < 0
if (field->logical_minimum < 0) /* signed values */
^
drivers/hid/hid-core.c:1815:3: note: Taking true branch
if (field->logical_minimum < 0) /* signed values */
^
drivers/hid/hid-core.c:1817:31: note: Passing the value 32 via 2nd parameter 'n'
s32ton(field->value[n], size));
^~~~
drivers/hid/hid-core.c:1817:7: note: Calling 's32ton'
s32ton(field->value[n], size));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1339:6: note: Assuming 'a' is 0
if (a && a != -1)
^
drivers/hid/hid-core.c:1339:8: note: Left side of '&&' is false
if (a && a != -1)
^
drivers/hid/hid-core.c:1341:21: note: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'int'
return value & ((1 << n) - 1);
^ ~
>> drivers/hid/hid-core.c:1665:30: warning: Although the value stored to 'field' is used in the enclosing expression, the value is never actually read from 'field' [clang-analyzer-deadcode.DeadStores]
hid_input_fetch_field(hid, field = report->field[a], data);
^ ~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1665:30: note: Although the value stored to 'field' is used in the enclosing expression, the value is never actually read from 'field'
hid_input_fetch_field(hid, field = report->field[a], data);
^ ~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:2198:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores]
len += sprintf(buf + len, "%shidraw%d", len ? "," : "",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:2198:3: note: Value stored to 'len' is never read
len += sprintf(buf + len, "%shidraw%d", len ? "," : "",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
include/linux/hid.h:1049:9: warning: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input') [clang-analyzer-core.NullDereference]
input->name, c, type);
^
drivers/hid/hid-corsair.c:635:6: note: Assuming the condition is false
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_KEYBOARD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-corsair.c:635:2: note: Taking false branch
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_KEYBOARD)
^
drivers/hid/hid-corsair.c:639:6: note: 'gkey' is not equal to 0
if (gkey != 0) {
^~~~
drivers/hid/hid-corsair.c:639:2: note: Taking true branch
if (gkey != 0) {
^
drivers/hid/hid-corsair.c:640:3: note: Calling 'hid_map_usage_clear'
hid_map_usage_clear(input, usage, bit, max, EV_KEY,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:1077:2: note: Calling 'hid_map_usage'
hid_map_usage(hidinput, usage, bit, max, type, c);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:1020:2: note: 'input' initialized here
struct input_dev *input = hidinput->input;
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:1024:2: note: Control jumps to 'case 1:' at line 1033
switch (type) {
^
include/linux/hid.h:1036:3: note: Execution continues on line 1047
break;
^
include/linux/hid.h:1047:15: note: Assuming 'c' is <= 'limit'
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/hid.h:1047:15: note: Left side of '||' is false
if (unlikely(c > limit || !bmap)) {
^
include/linux/hid.h:1047:28: note: Assuming 'bmap' is null
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/hid.h:1047:28: note: Assuming pointer value is null
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/hid.h:1047:2: note: Taking true branch
if (unlikely(c > limit || !bmap)) {
^
include/linux/hid.h:1048:3: note: Assuming the condition is true
pr_warn_ratelimited("%s: Invalid code %d type %d\n",
^
include/linux/printk.h:660:2: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:643:6: note: expanded from macro 'printk_ratelimited'
if (__ratelimit(&_rs)) \
^~~~~~~~~~~~~~~~~
include/linux/ratelimit_types.h:41:28: note: expanded from macro '__ratelimit'
#define __ratelimit(state) ___ratelimit(state, __func__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:1048:3: note: Taking true branch
pr_warn_ratelimited("%s: Invalid code %d type %d\n",
^
include/linux/printk.h:660:2: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:643:2: note: expanded from macro 'printk_ratelimited'
if (__ratelimit(&_rs)) \
^
include/linux/hid.h:1048:3: note: Loop condition is false. Exiting loop
pr_warn_ratelimited("%s: Invalid code %d type %d\n",
^
include/linux/printk.h:660:2: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:644:3: note: expanded from macro 'printk_ratelimited'
printk(fmt, ##__VA_ARGS__); \
vim +1665 drivers/hid/hid-core.c
dde5845a529ff7 Jiri Kosina 2006-12-08 1648
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1649 /*
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1650 * Analyse a received report, and fetch the data from it. The field
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1651 * content is stored for next report processing (we do differential
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1652 * reporting to the layer).
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1653 */
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1654 static void hid_process_report(struct hid_device *hid,
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1655 struct hid_report *report,
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1656 __u8 *data,
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1657 int interrupt)
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1658 {
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1659 unsigned int a;
5f297c23cba491 Benjamin Tissoires 2022-01-26 1660 struct hid_field_entry *entry;
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1661 struct hid_field *field;
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1662
5f297c23cba491 Benjamin Tissoires 2022-01-26 1663 /* first retrieve all incoming values in data */
5f297c23cba491 Benjamin Tissoires 2022-01-26 1664 for (a = 0; a < report->maxfield; a++)
5f297c23cba491 Benjamin Tissoires 2022-01-26 @1665 hid_input_fetch_field(hid, field = report->field[a], data);
5f297c23cba491 Benjamin Tissoires 2022-01-26 1666
5f297c23cba491 Benjamin Tissoires 2022-01-26 1667 if (!list_empty(&report->field_entry_list)) {
5f297c23cba491 Benjamin Tissoires 2022-01-26 1668 /* INPUT_REPORT, we have a priority list of fields */
5f297c23cba491 Benjamin Tissoires 2022-01-26 1669 list_for_each_entry(entry,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1670 &report->field_entry_list,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1671 list) {
5f297c23cba491 Benjamin Tissoires 2022-01-26 1672 field = entry->field;
5f297c23cba491 Benjamin Tissoires 2022-01-26 1673
5f297c23cba491 Benjamin Tissoires 2022-01-26 1674 if (field->flags & HID_MAIN_ITEM_VARIABLE)
5f297c23cba491 Benjamin Tissoires 2022-01-26 1675 hid_process_event(hid,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1676 field,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1677 &field->usage[entry->index],
5f297c23cba491 Benjamin Tissoires 2022-01-26 1678 field->new_value[entry->index],
5f297c23cba491 Benjamin Tissoires 2022-01-26 1679 interrupt);
5f297c23cba491 Benjamin Tissoires 2022-01-26 1680 else
5f297c23cba491 Benjamin Tissoires 2022-01-26 1681 hid_input_array_field(hid, field, interrupt);
5f297c23cba491 Benjamin Tissoires 2022-01-26 1682 }
5f297c23cba491 Benjamin Tissoires 2022-01-26 1683
5f297c23cba491 Benjamin Tissoires 2022-01-26 1684 /* we need to do the memcpy at the end for var items */
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1685 for (a = 0; a < report->maxfield; a++) {
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1686 field = report->field[a];
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1687
5f297c23cba491 Benjamin Tissoires 2022-01-26 1688 if (field->flags & HID_MAIN_ITEM_VARIABLE)
5f297c23cba491 Benjamin Tissoires 2022-01-26 1689 memcpy(field->value, field->new_value,
5f297c23cba491 Benjamin Tissoires 2022-01-26 1690 field->report_count * sizeof(__s32));
5f297c23cba491 Benjamin Tissoires 2022-01-26 1691 }
5f297c23cba491 Benjamin Tissoires 2022-01-26 1692 } else {
5f297c23cba491 Benjamin Tissoires 2022-01-26 1693 /* FEATURE_REPORT, regular processing */
5f297c23cba491 Benjamin Tissoires 2022-01-26 1694 for (a = 0; a < report->maxfield; a++) {
5f297c23cba491 Benjamin Tissoires 2022-01-26 1695 field = report->field[a];
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1696
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1697 if (field->flags & HID_MAIN_ITEM_VARIABLE)
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1698 hid_input_var_field(hid, field, interrupt);
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1699 else
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1700 hid_input_array_field(hid, field, interrupt);
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1701 }
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1702 }
5f297c23cba491 Benjamin Tissoires 2022-01-26 1703 }
d95c6e8572e0df Benjamin Tissoires 2022-01-26 1704
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 00/12] HID: fix for generic input processing
@ 2022-01-26 16:18 Benjamin Tissoires
2022-01-26 16:18 ` [PATCH 08/12] HID: core: for input reports, process the usages by priority list Benjamin Tissoires
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Tissoires @ 2022-01-26 16:18 UTC (permalink / raw)
To: Jiri Kosina, Dmitry Torokhov, Jonathan Corbet,
Ahelenia Ziemiańska, Ping Cheng, Aaron Armstrong Skomra,
Jason Gerecke, Peter Hutterer
Cc: linux-input, linux-doc, linux-kernel, Benjamin Tissoires
Hi,
This is a followup of the discussion we had between Wacom and
the maintainers, and a followup of those 2 patch series:
https://lore.kernel.org/r/20211022232837.18988-1-ping.cheng@wacom.com/
https://lore.kernel.org/r/2ca91ac7cf92e3048a236db3cd519f04e12c1e61.1615224800.git.nabijaczleweli@nabijaczleweli.xyz/
It took me a while to get it right, but I finally can submit the
series:
- the first 8 patches are some cleanup in the hid-input.c and
hid-core.c code. They also create a list of input fields that
is then used to process the event, in the priority we think
is good.
For instance, on multitouch devices, it is better to have
Contact Count before processing all touches, and in each
touch, having Contact ID first is better. This series doesn't
cover hid-multitouch, but I have a series on top of this one that
does cover it.
Anyway, in our case, here, we need to process Invert before
In Range for tablets so we can make a decision whether the user
has the intend to erase or not.
- patch 9 enforces the invert usage before In Range as mentioned
above
- patch 10 is the actual bulk of processing that should fix the
generic tablet handling. Now that we have a reliable ordering
of the fields, we can compute the state of the tool in a reliable
way, and be kinder to userspace by not sending to it 2 tools at
the same time.
This patch has been extensively tested by hid-tools with the new
MR I submitted that add tests for tablets [0].
- patch 11 is a nice to have that I need for my second series regarding
hid-multitouch. It is not mandatory with that series, but given
that it changes the format of the priorities in hid-input.c I thought
it would be best to send it as part of this series.
Note that now we are tagging the *reports* and the individual fields
when they are part of a multitouch collection, which should help
the drivers that implement this processing (hid-multitouch and wacom).
- last, patch 12 is an attempt at fixing the documentation regarding
BTN_TOOL_* (requested by Peter).
Dmitry, feel free to take this one through your tree if you prefer
to do so (and if you are happy with it), otherwise we can take it
through the hid tree.
As mentioned above, I have a followup series not entirely tidied up
that implements the processing of Win8 mutltiouch devices in
hid-input.c.
There are several benefits for that: we should be able to drop the
multitouch code in wacom.ko, we can simplify part of hid-multitouch,
and we will be able to quirk a particular device in a separate module,
without touching at the generic code (in hid-multitouch or hid-input).
Anyway, I am missing a few bits for that so that's coming in later.
Cheers,
Benjamin
[0] https://gitlab.freedesktop.org/libevdev/hid-tools/-/merge_requests/127
Benjamin Tissoires (12):
HID: core: statically allocate read buffers
HID: core: de-duplicate some code in hid_input_field()
HID: core: split data fetching from processing in hid_input_field()
HID: input: tag touchscreens as such if the physical is not there
HID: input: rework spaghetti code with switch statements
HID: input: move up out-of-range processing of input values
HID: compute an ordered list of input fields to process
HID: core: for input reports, process the usages by priority list
HID: input: enforce Invert usage to be processed before InRange
HID: input: remove the need for HID_QUIRK_INVERT
HID: input: accommodate priorities for slotted devices
Input: docs: add more details on the use of BTN_TOOL
Documentation/input/event-codes.rst | 5 +-
drivers/hid/hid-core.c | 280 ++++++++++++++++++++---
drivers/hid/hid-input.c | 330 ++++++++++++++++++++++------
include/linux/hid.h | 23 +-
4 files changed, 533 insertions(+), 105 deletions(-)
--
2.33.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 08/12] HID: core: for input reports, process the usages by priority list
2022-01-26 16:18 [PATCH 00/12] HID: fix for generic input processing Benjamin Tissoires
@ 2022-01-26 16:18 ` Benjamin Tissoires
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2022-01-26 16:18 UTC (permalink / raw)
To: Jiri Kosina, Dmitry Torokhov, Jonathan Corbet,
Ahelenia Ziemiańska, Ping Cheng, Aaron Armstrong Skomra,
Jason Gerecke, Peter Hutterer
Cc: linux-input, linux-doc, linux-kernel, Benjamin Tissoires
Now that we have a list of fields/usages by priority order,
walk through that list to process the inputs instead of using the
order provided by the manufacturer.
Note that this changes the way we update the values in the struct
hid_field:
Previously, once a field was processed, we updated the new values.
Now we need to wait for the entire report to be processed to update
the values.
I don't think it will be an issue: because we were relying on the device
ordering, there were no guarantees to have a field stored before an other.
Which is why we introduced .report() in drivers to have those values
updated.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/hid/hid-core.c | 45 +++++++++++++++++++++++++++++++++++-------
1 file changed, 38 insertions(+), 7 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b38528118642..db925794fbe6 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1657,17 +1657,48 @@ static void hid_process_report(struct hid_device *hid,
int interrupt)
{
unsigned int a;
+ struct hid_field_entry *entry;
struct hid_field *field;
- for (a = 0; a < report->maxfield; a++) {
- field = report->field[a];
+ /* first retrieve all incoming values in data */
+ for (a = 0; a < report->maxfield; a++)
+ hid_input_fetch_field(hid, field = report->field[a], data);
+
+ if (!list_empty(&report->field_entry_list)) {
+ /* INPUT_REPORT, we have a priority list of fields */
+ list_for_each_entry(entry,
+ &report->field_entry_list,
+ list) {
+ field = entry->field;
+
+ if (field->flags & HID_MAIN_ITEM_VARIABLE)
+ hid_process_event(hid,
+ field,
+ &field->usage[entry->index],
+ field->new_value[entry->index],
+ interrupt);
+ else
+ hid_input_array_field(hid, field, interrupt);
+ }
- hid_input_fetch_field(hid, field, data);
+ /* we need to do the memcpy at the end for var items */
+ for (a = 0; a < report->maxfield; a++) {
+ field = report->field[a];
- if (field->flags & HID_MAIN_ITEM_VARIABLE)
- hid_input_var_field(hid, field, interrupt);
- else
- hid_input_array_field(hid, field, interrupt);
+ if (field->flags & HID_MAIN_ITEM_VARIABLE)
+ memcpy(field->value, field->new_value,
+ field->report_count * sizeof(__s32));
+ }
+ } else {
+ /* FEATURE_REPORT, regular processing */
+ for (a = 0; a < report->maxfield; a++) {
+ field = report->field[a];
+
+ if (field->flags & HID_MAIN_ITEM_VARIABLE)
+ hid_input_var_field(hid, field, interrupt);
+ else
+ hid_input_array_field(hid, field, interrupt);
+ }
}
}
--
2.33.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-29 21:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-28 13:52 [PATCH 08/12] HID: core: for input reports, process the usages by priority list kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-01-29 21:57 kernel test robot
2022-01-26 16:18 [PATCH 00/12] HID: fix for generic input processing Benjamin Tissoires
2022-01-26 16:18 ` [PATCH 08/12] HID: core: for input reports, process the usages by priority list Benjamin Tissoires
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.