lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202210291931.zGXW0epb-lkp@intel.com>
Date:   Wed, 2 Nov 2022 15:11:43 +0300
From:   Dan Carpenter <error27@...il.com>
To:     oe-kbuild@...ts.linux.dev,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        Greg KH <greg@...ah.com>, Jiri Kosina <jikos@...nel.org>,
        Jonathan Corbet <corbet@....net>,
        Shuah Khan <skhan@...uxfoundation.org>
Cc:     lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
        Tero Kristo <tero.kristo@...ux.intel.com>,
        linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
        bpf@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-doc@...r.kernel.org,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>
Subject: Re: [PATCH hid v11 07/14] HID: bpf: introduce hid_hw_request()

Hi Benjamin,

url:    https://github.com/intel-lab-lkp/linux/commits/Benjamin-Tissoires/Introduce-eBPF-support-for-HID-devices/20221025-173852
base:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git master
patch link:    https://lore.kernel.org/r/20221025093458.457089-8-benjamin.tissoires%40redhat.com
patch subject: [PATCH hid v11 07/14] HID: bpf: introduce hid_hw_request()
config: riscv-randconfig-m041-20221029
compiler: riscv32-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <error27@...il.com>

smatch warnings:
drivers/hid/bpf/hid_bpf_dispatch.c:297 hid_bpf_hw_request() warn: variable dereferenced before check 'ctx' (see line 289)

vim +/ctx +297 drivers/hid/bpf/hid_bpf_dispatch.c

eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  285  noinline int
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  286  hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz,
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  287  		   enum hid_report_type rtype, enum hid_class_request reqtype)
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  288  {
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25 @289  	struct hid_device *hdev = (struct hid_device *)ctx->hid; /* discard const */
                                                                                                       ^^^^^^^^
Dereference

eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  290  	struct hid_report *report;
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  291  	struct hid_report_enum *report_enum;
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  292  	u8 *dma_data;
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  293  	u32 report_len;
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  294  	int ret;
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  295  
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  296  	/* check arguments */
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25 @297  	if (!ctx || !hid_bpf_ops || !buf)
                                                             ^^^
Checked too late.

eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  298  		return -EINVAL;
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  299  
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  300  	switch (rtype) {
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  301  	case HID_INPUT_REPORT:
eaf51f2d4f8561 Benjamin Tissoires 2022-10-25  302  	case HID_OUTPUT_REPORT:

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ