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] [day] [month] [year] [list]
Message-ID: <202410051833.7M7dq3rD-lkp@intel.com>
Date: Sat, 5 Oct 2024 18:11:22 +0800
From: kernel test robot <lkp@...el.com>
To: Manuel Quintero F <sakunix@...oo.com>, duncan.sands@...e.fr
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, Manuel Quintero F <sakunix@...oo.com>
Subject: Re: [PATCH] USB: atm: speedtch: do not use assignment in if condition

Hi Manuel,

kernel test robot noticed the following build errors:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.12-rc1 next-20241004]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Manuel-Quintero-F/USB-atm-speedtch-do-not-use-assignment-in-if-condition/20241004-113643
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20241004030512.2036-1-sakunix%40yahoo.com
patch subject: [PATCH] USB: atm: speedtch: do not use assignment in if condition
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20241005/202410051833.7M7dq3rD-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241005/202410051833.7M7dq3rD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410051833.7M7dq3rD-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/usb/atm/speedtch.c:26:
   In file included from drivers/usb/atm/usbatm.h:14:
   In file included from include/linux/atmdev.h:9:
   In file included from include/linux/net.h:24:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from drivers/usb/atm/speedtch.c:26:
   In file included from drivers/usb/atm/usbatm.h:14:
   In file included from include/linux/atmdev.h:11:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from drivers/usb/atm/speedtch.c:26:
   In file included from drivers/usb/atm/usbatm.h:14:
   In file included from include/linux/atmdev.h:11:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from drivers/usb/atm/speedtch.c:26:
   In file included from drivers/usb/atm/usbatm.h:14:
   In file included from include/linux/atmdev.h:11:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
>> drivers/usb/atm/speedtch.c:329:2: error: expected ')'
     329 |         if (ret < 0) {
         |         ^
   drivers/usb/atm/speedtch.c:327:25: note: to match this '('
     327 |         ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->params.altsetting
         |                                ^
   7 warnings and 1 error generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for MODVERSIONS
   Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
   Selected by [y]:
   - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=y] || GCC_PLUGINS [=n]) && MODULES [=y]
   WARNING: unmet direct dependencies detected for GET_FREE_REGION
   Depends on [n]: SPARSEMEM [=n]
   Selected by [m]:
   - RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]


vim +329 drivers/usb/atm/speedtch.c

   229	
   230	static int speedtch_upload_firmware(struct speedtch_instance_data *instance,
   231					     const struct firmware *fw1,
   232					     const struct firmware *fw2)
   233	{
   234		unsigned char *buffer;
   235		struct usbatm_data *usbatm = instance->usbatm;
   236		struct usb_device *usb_dev = usbatm->usb_dev;
   237		int actual_length;
   238		int ret = 0;
   239		int offset;
   240	
   241		usb_dbg(usbatm, "%s entered\n", __func__);
   242	
   243		buffer = (unsigned char *)__get_free_page(GFP_KERNEL);
   244		if (!buffer) {
   245			ret = -ENOMEM;
   246			usb_dbg(usbatm, "%s: no memory for buffer!\n", __func__);
   247			goto out;
   248		}
   249	
   250		if (!usb_ifnum_to_if(usb_dev, 2)) {
   251			ret = -ENODEV;
   252			usb_dbg(usbatm, "%s: interface not found!\n", __func__);
   253			goto out_free;
   254		}
   255	
   256		/* URB 7 */
   257		if (dl_512_first) {	/* some modems need a read before writing the firmware */
   258			ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
   259					   buffer, 0x200, &actual_length, 2000);
   260	
   261			if (ret < 0 && ret != -ETIMEDOUT)
   262				usb_warn(usbatm, "%s: read BLOCK0 from modem failed (%d)!\n", __func__, ret);
   263			else
   264				usb_dbg(usbatm, "%s: BLOCK0 downloaded (%d bytes)\n", __func__, ret);
   265		}
   266	
   267		/* URB 8 : both leds are static green */
   268		for (offset = 0; offset < fw1->size; offset += PAGE_SIZE) {
   269			int thislen = min_t(int, PAGE_SIZE, fw1->size - offset);
   270			memcpy(buffer, fw1->data + offset, thislen);
   271	
   272			ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
   273					   buffer, thislen, &actual_length, DATA_TIMEOUT);
   274	
   275			if (ret < 0) {
   276				usb_err(usbatm, "%s: write BLOCK1 to modem failed (%d)!\n", __func__, ret);
   277				goto out_free;
   278			}
   279			usb_dbg(usbatm, "%s: BLOCK1 uploaded (%zu bytes)\n", __func__, fw1->size);
   280		}
   281	
   282		/* USB led blinking green, ADSL led off */
   283	
   284		/* URB 11 */
   285		ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
   286				   buffer, 0x200, &actual_length, DATA_TIMEOUT);
   287	
   288		if (ret < 0) {
   289			usb_err(usbatm, "%s: read BLOCK2 from modem failed (%d)!\n", __func__, ret);
   290			goto out_free;
   291		}
   292		usb_dbg(usbatm, "%s: BLOCK2 downloaded (%d bytes)\n", __func__, actual_length);
   293	
   294		/* URBs 12 to 139 - USB led blinking green, ADSL led off */
   295		for (offset = 0; offset < fw2->size; offset += PAGE_SIZE) {
   296			int thislen = min_t(int, PAGE_SIZE, fw2->size - offset);
   297			memcpy(buffer, fw2->data + offset, thislen);
   298	
   299			ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
   300					   buffer, thislen, &actual_length, DATA_TIMEOUT);
   301	
   302			if (ret < 0) {
   303				usb_err(usbatm, "%s: write BLOCK3 to modem failed (%d)!\n", __func__, ret);
   304				goto out_free;
   305			}
   306		}
   307		usb_dbg(usbatm, "%s: BLOCK3 uploaded (%zu bytes)\n", __func__, fw2->size);
   308	
   309		/* USB led static green, ADSL led static red */
   310	
   311		/* URB 142 */
   312		ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
   313				   buffer, 0x200, &actual_length, DATA_TIMEOUT);
   314	
   315		if (ret < 0) {
   316			usb_err(usbatm, "%s: read BLOCK4 from modem failed (%d)!\n", __func__, ret);
   317			goto out_free;
   318		}
   319	
   320		/* success */
   321		usb_dbg(usbatm, "%s: BLOCK4 downloaded (%d bytes)\n", __func__, actual_length);
   322	
   323		/* Delay to allow firmware to start up. We can do this here
   324		   because we're in our own kernel thread anyway. */
   325		msleep_interruptible(1000);
   326	
   327		ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->params.altsetting
   328	
 > 329		if (ret < 0) {
   330			usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->params.altsetting, ret);
   331			goto out_free;
   332		}
   333	
   334		/* Enable software buffering, if requested */
   335		if (sw_buffering)
   336			speedtch_set_swbuff(instance, 1);
   337	
   338		/* Magic spell; don't ask us what this does */
   339		speedtch_test_sequence(instance);
   340	
   341		ret = 0;
   342	
   343	out_free:
   344		free_page((unsigned long)buffer);
   345	out:
   346		return ret;
   347	}
   348	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ