[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111110342.nII9NlUT-lkp@intel.com>
Date: Thu, 11 Nov 2021 03:39:02 +0800
From: kernel test robot <lkp@...el.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>
Subject: drivers/net/ethernet/xilinx/xilinx_emaclite.c:417:24: sparse:
sparse: cast to restricted __be32
Hi Andrew,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cb690f5238d71f543f4ce874aa59237cf53a877c
commit: 03dfd157670bd715306dce1507b8998cabd38539 drivers: net: xilinx_emaclite: Add COMPILE_TEST support
date: 12 months ago
config: sparc-randconfig-s032-20211109 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=03dfd157670bd715306dce1507b8998cabd38539
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 03dfd157670bd715306dce1507b8998cabd38539
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc SHELL=/bin/bash arch/sparc/vdso/ drivers/gpu/drm/ drivers/net/ethernet/xilinx/ drivers/net/wireguard/ fs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/xilinx/xilinx_emaclite.c:417:24: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/xilinx/xilinx_emaclite.c:427:36: sparse: sparse: cast to restricted __be32
vim +417 drivers/net/ethernet/xilinx/xilinx_emaclite.c
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 368
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 369 /**
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 370 * xemaclite_recv_data - Receive a frame
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 371 * @drvdata: Pointer to the Emaclite device private data
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 372 * @data: Address where the data is to be received
f713d50f33c1fbd drivers/net/ethernet/xilinx/xilinx_emaclite.c Radhey Shyam Pandey 2018-06-28 373 * @maxlen: Maximum supported ethernet packet length
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 374 *
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 375 * This function is intended to be called from the interrupt context or
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 376 * with a wrapper which waits for the receive frame to be available.
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 377 *
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 378 * Return: Total number of bytes received
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 379 */
cd224553641848d drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 380 static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data, int maxlen)
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 381 {
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 382 void __iomem *addr;
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 383 u16 length, proto_type;
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 384 u32 reg_data;
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 385
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 386 /* Determine the expected buffer address */
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 387 addr = (drvdata->base_addr + drvdata->next_rx_buf_to_use);
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 388
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 389 /* Verify which buffer has valid data */
acf138f1b00bdd1 drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 390 reg_data = xemaclite_readl(addr + XEL_RSR_OFFSET);
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 391
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 392 if ((reg_data & XEL_RSR_RECV_DONE_MASK) == XEL_RSR_RECV_DONE_MASK) {
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 393 if (drvdata->rx_ping_pong != 0)
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 394 drvdata->next_rx_buf_to_use ^= XEL_BUFFER_OFFSET;
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 395 } else {
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 396 /* The instance is out of sync, try other buffer if other
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 397 * buffer is configured, return 0 otherwise. If the instance is
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 398 * out of sync, do not update the 'next_rx_buf_to_use' since it
49a83f002731dbf drivers/net/ethernet/xilinx/xilinx_emaclite.c Radhey Shyam Pandey 2018-06-28 399 * will correct on subsequent calls
49a83f002731dbf drivers/net/ethernet/xilinx/xilinx_emaclite.c Radhey Shyam Pandey 2018-06-28 400 */
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 401 if (drvdata->rx_ping_pong != 0)
eccd5403814b4e7 drivers/net/ethernet/xilinx/xilinx_emaclite.c Andrew Lunn 2020-11-10 402 addr = (void __iomem __force *)
eccd5403814b4e7 drivers/net/ethernet/xilinx/xilinx_emaclite.c Andrew Lunn 2020-11-10 403 ((uintptr_t __force)addr ^
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 404 XEL_BUFFER_OFFSET);
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 405 else
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 406 return 0; /* No data was available */
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 407
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 408 /* Verify that buffer has valid data */
acf138f1b00bdd1 drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 409 reg_data = xemaclite_readl(addr + XEL_RSR_OFFSET);
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 410 if ((reg_data & XEL_RSR_RECV_DONE_MASK) !=
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 411 XEL_RSR_RECV_DONE_MASK)
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 412 return 0; /* No data was available */
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 413 }
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 414
49a83f002731dbf drivers/net/ethernet/xilinx/xilinx_emaclite.c Radhey Shyam Pandey 2018-06-28 415 /* Get the protocol type of the ethernet frame that arrived
49a83f002731dbf drivers/net/ethernet/xilinx/xilinx_emaclite.c Radhey Shyam Pandey 2018-06-28 416 */
acf138f1b00bdd1 drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 @417 proto_type = ((ntohl(xemaclite_readl(addr + XEL_HEADER_OFFSET +
44180a573ec936c drivers/net/xilinx_emaclite.c Michal Simek 2010-09-10 418 XEL_RXBUFF_OFFSET)) >> XEL_HEADER_SHIFT) &
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 419 XEL_RPLR_LENGTH_MASK);
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 420
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 421 /* Check if received ethernet frame is a raw ethernet frame
49a83f002731dbf drivers/net/ethernet/xilinx/xilinx_emaclite.c Radhey Shyam Pandey 2018-06-28 422 * or an IP packet or an ARP packet
49a83f002731dbf drivers/net/ethernet/xilinx/xilinx_emaclite.c Radhey Shyam Pandey 2018-06-28 423 */
cd224553641848d drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 424 if (proto_type > ETH_DATA_LEN) {
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 425
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 426 if (proto_type == ETH_P_IP) {
acf138f1b00bdd1 drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 427 length = ((ntohl(xemaclite_readl(addr +
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 428 XEL_HEADER_IP_LENGTH_OFFSET +
44180a573ec936c drivers/net/xilinx_emaclite.c Michal Simek 2010-09-10 429 XEL_RXBUFF_OFFSET)) >>
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 430 XEL_HEADER_SHIFT) &
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 431 XEL_RPLR_LENGTH_MASK);
cd224553641848d drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 432 length = min_t(u16, length, ETH_DATA_LEN);
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 433 length += ETH_HLEN + ETH_FCS_LEN;
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 434
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 435 } else if (proto_type == ETH_P_ARP)
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 436 length = XEL_ARP_PACKET_SIZE + ETH_HLEN + ETH_FCS_LEN;
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 437 else
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 438 /* Field contains type other than IP or ARP, use max
49a83f002731dbf drivers/net/ethernet/xilinx/xilinx_emaclite.c Radhey Shyam Pandey 2018-06-28 439 * frame size and let user parse it
49a83f002731dbf drivers/net/ethernet/xilinx/xilinx_emaclite.c Radhey Shyam Pandey 2018-06-28 440 */
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 441 length = ETH_FRAME_LEN + ETH_FCS_LEN;
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 442 } else
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 443 /* Use the length in the frame, plus the header and trailer */
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 444 length = proto_type + ETH_HLEN + ETH_FCS_LEN;
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 445
cd224553641848d drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 446 if (WARN_ON(length > maxlen))
cd224553641848d drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 447 length = maxlen;
cd224553641848d drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 448
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 449 /* Read from the EmacLite device */
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 450 xemaclite_aligned_read((u32 __force *)(addr + XEL_RXBUFF_OFFSET),
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 451 data, length);
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 452
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 453 /* Acknowledge the frame */
acf138f1b00bdd1 drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 454 reg_data = xemaclite_readl(addr + XEL_RSR_OFFSET);
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 455 reg_data &= ~XEL_RSR_RECV_DONE_MASK;
acf138f1b00bdd1 drivers/net/ethernet/xilinx/xilinx_emaclite.c Anssi Hannula 2017-02-14 456 xemaclite_writel(reg_data, addr + XEL_RSR_OFFSET);
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 457
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 458 return length;
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 459 }
bb81b2ddfa194b6 drivers/net/xilinx_emaclite.c John Linn 2009-08-20 460
:::::: The code at line 417 was first introduced by commit
:::::: acf138f1b00bdd1b7cd9894562ed0c2a1670888e net: xilinx_emaclite: fix freezes due to unordered I/O
:::::: TO: Anssi Hannula <anssi.hannula@...wise.fi>
:::::: CC: David S. Miller <davem@...emloft.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (32346 bytes)
Powered by blists - more mailing lists