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]
Date:   Tue, 12 Jan 2021 23:29:43 +0800
From:   kernel test robot <lkp@...el.com>
To:     Vincent Mailhol <mailhol.vincent@...adoo.fr>,
        Marc Kleine-Budde <mkl@...gutronix.de>,
        linux-can@...r.kernel.org
Cc:     kbuild-all@...ts.01.org,
        Vincent Mailhol <mailhol.vincent@...adoo.fr>,
        Arunachalam Santhanam <arunachalam.santhanam@...bosch.com>,
        Wolfgang Grandegger <wg@...ndegger.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Jimmy Assarsson <extja@...ser.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        "open list : NETWORKING DRIVERS" <netdev@...r.kernel.org>
Subject: Re: [PATCH v10 1/1] can: usb: etas_es58X: add support for ETAS ES58X
 CAN USB interfaces

Hi Vincent,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.11-rc3 next-20210111]
[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/Vincent-Mailhol/add-support-for-ETAS-ES58X-CAN-USB-interfaces/20210112-211624
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a0d54b4f5b219fb31f0776e9f53aa137e78ae431
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
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
        # https://github.com/0day-ci/linux/commit/5f55487bd139c33d619a9c8cd8dbd5cb8b558526
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Vincent-Mailhol/add-support-for-ETAS-ES58X-CAN-USB-interfaces/20210112-211624
        git checkout 5f55487bd139c33d619a9c8cd8dbd5cb8b558526
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10,
                    from drivers/net/can/usb/etas_es58x/es58x_core.c:13:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   arch/m68k/include/asm/page_mm.h:174:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     174 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:137:2: note: in expansion of macro 'BUG_ON'
     137 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:137:10: note: in expansion of macro 'virt_addr_valid'
     137 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   drivers/net/can/usb/etas_es58x/es58x_core.c: In function 'es58x_can_free_echo_skb_tail':
>> drivers/net/can/usb/etas_es58x/es58x_core.c:393:52: error: 'struct can_skb_priv' has no member named 'frame_len'
     393 |  netdev_completed_queue(netdev, 1, can_skb_prv(skb)->frame_len);
         |                                                    ^~
   drivers/net/can/usb/etas_es58x/es58x_core.c: In function 'es58x_can_get_echo_skb':
>> drivers/net/can/usb/etas_es58x/es58x_core.c:561:29: error: too many arguments to function 'can_get_echo_skb'
     561 |   netdev->stats.tx_bytes += can_get_echo_skb(netdev, tail_idx,
         |                             ^~~~~~~~~~~~~~~~
   In file included from drivers/net/can/usb/etas_es58x/es58x_core.h:19,
                    from drivers/net/can/usb/etas_es58x/es58x_core.c:21:
   include/linux/can/dev.h:247:14: note: declared here
     247 | unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
         |              ^~~~~~~~~~~~~~~~
   drivers/net/can/usb/etas_es58x/es58x_core.c: In function 'es58x_start_xmit':
>> drivers/net/can/usb/etas_es58x/es58x_core.c:2104:14: error: implicit declaration of function 'can_skb_get_frame_len' [-Werror=implicit-function-declaration]
    2104 |  frame_len = can_skb_get_frame_len(skb);
         |              ^~~~~~~~~~~~~~~~~~~~~
>> drivers/net/can/usb/etas_es58x/es58x_core.c:2106:8: error: too many arguments to function 'can_put_echo_skb'
    2106 |  ret = can_put_echo_skb(skb, netdev, skb_idx, frame_len);
         |        ^~~~~~~~~~~~~~~~
   In file included from drivers/net/can/usb/etas_es58x/es58x_core.h:19,
                    from drivers/net/can/usb/etas_es58x/es58x_core.c:21:
   include/linux/can/dev.h:243:5: note: declared here
     243 | int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
         |     ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/kernel.h:10,
                    from drivers/net/can/usb/etas_es58x/es581_4.c:12:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   arch/m68k/include/asm/page_mm.h:174:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     174 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:137:2: note: in expansion of macro 'BUG_ON'
     137 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:137:10: note: in expansion of macro 'virt_addr_valid'
     137 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   drivers/net/can/usb/etas_es58x/es581_4.c: At top level:
>> drivers/net/can/usb/etas_es58x/es581_4.c:532:19: error: 'CAN_FRAME_LEN_MAX' undeclared here (not in a function)
     532 |  .dql_limit_min = CAN_FRAME_LEN_MAX * 50,
         |                   ^~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kernel.h:10,
                    from drivers/net/can/usb/etas_es58x/es58x_fd.c:14:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   arch/m68k/include/asm/page_mm.h:174:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     174 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:137:2: note: in expansion of macro 'BUG_ON'
     137 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:137:10: note: in expansion of macro 'virt_addr_valid'
     137 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   drivers/net/can/usb/etas_es58x/es58x_fd.c: In function 'es58x_fd_rx_can_msg':
>> drivers/net/can/usb/etas_es58x/es58x_fd.c:37:15: error: implicit declaration of function 'canfd_sanitize_len' [-Werror=implicit-function-declaration]
      37 |   __msg_len = canfd_sanitize_len(__msg.len);  \
         |               ^~~~~~~~~~~~~~~~~~
   drivers/net/can/usb/etas_es58x/es58x_fd.c:123:24: note: in expansion of macro 'es58x_fd_sizeof_rx_tx_msg'
     123 |   u16 rx_can_msg_len = es58x_fd_sizeof_rx_tx_msg(*rx_can_msg);
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/can/usb/etas_es58x/es58x_fd.c: At top level:
>> drivers/net/can/usb/etas_es58x/es58x_fd.c:642:19: error: 'CAN_FRAME_LEN_MAX' undeclared here (not in a function)
     642 |  .dql_limit_min = CAN_FRAME_LEN_MAX * 15,
         |                   ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +393 drivers/net/can/usb/etas_es58x/es58x_core.c

   377	
   378	/**
   379	 * es58x_can_free_echo_skb_tail() - Remove the oldest echo skb of the
   380	 *	loopback FIFO.
   381	 * @netdev: CAN network device.
   382	 *
   383	 * Naming convention: the tail is the beginning of the FIFO, i.e. the
   384	 * first skb to have entered the FIFO.
   385	 */
   386	static void es58x_can_free_echo_skb_tail(struct net_device *netdev)
   387	{
   388		struct es58x_priv *priv = es58x_priv(netdev);
   389		u16 tail_idx = priv->echo_skb_tail_idx;
   390		struct sk_buff *skb = priv->can.echo_skb[tail_idx];
   391		unsigned long flags;
   392	
 > 393		netdev_completed_queue(netdev, 1, can_skb_prv(skb)->frame_len);
   394		can_free_echo_skb(netdev, tail_idx);
   395	
   396		spin_lock_irqsave(&priv->echo_skb_spinlock, flags);
   397		es58x_add_skb_idx(priv, &priv->echo_skb_tail_idx, 1);
   398		priv->num_echo_skb--;
   399		spin_unlock_irqrestore(&priv->echo_skb_spinlock, flags);
   400	
   401		netdev->stats.tx_dropped++;
   402	}
   403	
   404	/**
   405	 * es58x_can_get_echo_skb_recovery() - Try to re-sync the loopback FIFO.
   406	 * @netdev: CAN network device.
   407	 * @packet_idx: Index
   408	 *
   409	 * This function should not be called under normal circumstances. In
   410	 * the unlikely case that one or several URB packages get dropped by
   411	 * the device, the index will get out of sync. Try to recover by
   412	 * dropping the echo skb packets with older indexes.
   413	 *
   414	 * Return: zero if recovery was successful, -EINVAL otherwise.
   415	 */
   416	static int es58x_can_get_echo_skb_recovery(struct net_device *netdev,
   417						   u32 packet_idx)
   418	{
   419		struct es58x_priv *priv = es58x_priv(netdev);
   420		u32 current_packet_idx, first_packet_idx, num_echo_skb;
   421		unsigned long flags;
   422		int ret = 0;
   423	
   424		netdev->stats.tx_errors++;
   425	
   426		spin_lock_irqsave(&priv->echo_skb_spinlock, flags);
   427		current_packet_idx = priv->current_packet_idx;
   428		num_echo_skb = priv->num_echo_skb;
   429		spin_unlock_irqrestore(&priv->echo_skb_spinlock, flags);
   430		first_packet_idx = current_packet_idx - num_echo_skb;
   431	
   432		if (net_ratelimit())
   433			netdev_warn(netdev,
   434				    "Bad loopback packet index: %u. First index: %u, end index %u, num_echo_skb: %02u/%02u\n",
   435				    packet_idx, first_packet_idx,
   436				    current_packet_idx - 1, num_echo_skb,
   437				    priv->can.echo_skb_max);
   438	
   439		if (packet_idx < first_packet_idx) {
   440			if (net_ratelimit())
   441				netdev_warn(netdev,
   442					    "Received loopback is from the past. Ignoring it\n");
   443			ret = -EINVAL;
   444		} else if ((s32)(packet_idx - current_packet_idx) >= 0LL) {
   445			if (net_ratelimit())
   446				netdev_err(netdev,
   447					   "Received loopback is from the future. Ignoring it\n");
   448			ret = -EINVAL;
   449		} else {
   450			if (net_ratelimit())
   451				netdev_warn(netdev,
   452					    "Loopback recovery: dropping %u echo skb from index %u to %u\n",
   453					    packet_idx - first_packet_idx,
   454					    first_packet_idx, packet_idx - 1);
   455			while (first_packet_idx != packet_idx) {
   456				if (num_echo_skb == 0)
   457					return -EINVAL;
   458				es58x_can_free_echo_skb_tail(netdev);
   459				first_packet_idx++;
   460				num_echo_skb--;
   461			}
   462		}
   463		return ret;
   464	}
   465	
   466	/**
   467	 * es58x_can_get_echo_skb() - Get the skb from the loopback FIFO and
   468	 *	loop it back locally.
   469	 * @netdev: CAN network device.
   470	 * @packet_idx: Index of the first packet.
   471	 * @tstamps: Array of hardware timestamps received from a ES58X device.
   472	 * @pkts: Number of packets (and so, length of @tstamps).
   473	 *
   474	 * Callback function for when we receive a self reception acknowledgment.
   475	 * Retrieves the skb from the loopback FIFO, sets its hardware timestamp
   476	 * (the actual time it was sent) and loops it back locally.
   477	 *
   478	 * The device has to be active (i.e. network interface UP and not in
   479	 * bus off state or restarting).
   480	 *
   481	 * Packet indexes must be consecutive (i.e. index of first packet is
   482	 * @packet_idx, index of second packet is @packet_idx + 1 and index of
   483	 * last packet is @packet_idx + @pkts - 1).
   484	 *
   485	 * Return: zero on success.
   486	 */
   487	int es58x_can_get_echo_skb(struct net_device *netdev, u32 packet_idx,
   488				   u64 *tstamps, unsigned int pkts)
   489	{
   490		struct es58x_priv *priv = es58x_priv(netdev);
   491		u16 tail_idx;
   492		u32 first_packet_idx;
   493		unsigned long flags;
   494		unsigned int rx_total_frame_len = 0;
   495		int i;
   496		int ret = 0;
   497	
   498		if (!netif_running(netdev)) {
   499			if (net_ratelimit())
   500				netdev_info(netdev,
   501					    "%s: %s is down, dropping %d loopback packets\n",
   502					    __func__, netdev->name, pkts);
   503			netdev->stats.tx_dropped++;
   504			return 0;
   505		} else if (!es58x_is_can_state_active(netdev)) {
   506			if (net_ratelimit())
   507				netdev_dbg(netdev,
   508					   "Bus is off or device is restarting. Ignoring %u loopback packets from index %u\n",
   509					   pkts, packet_idx);
   510			/* stats.tx_dropped will be (or was already)
   511			 * incremented by
   512			 * drivers/net/can/net/dev.c:can_flush_echo_skb().
   513			 */
   514			return 0;
   515		} else if (priv->num_echo_skb == 0) {
   516			if (net_ratelimit())
   517				netdev_warn(netdev,
   518					    "Received %u loopback packets from index: %u but echo skb queue is empty.\n",
   519					    pkts, packet_idx);
   520			netdev->stats.tx_dropped += pkts;
   521			return 0;
   522		}
   523	
   524		spin_lock_irqsave(&priv->echo_skb_spinlock, flags);
   525		first_packet_idx = priv->current_packet_idx - priv->num_echo_skb;
   526		if (first_packet_idx != packet_idx) {
   527			spin_unlock_irqrestore(&priv->echo_skb_spinlock, flags);
   528			ret = es58x_can_get_echo_skb_recovery(netdev, packet_idx);
   529			if (ret < 0) {
   530				if (net_ratelimit())
   531					netdev_warn(netdev,
   532						    "Could not find echo skb for loopback packet index: %u\n",
   533						    packet_idx);
   534				return 0;
   535			}
   536			spin_lock_irqsave(&priv->echo_skb_spinlock, flags);
   537			first_packet_idx =
   538			    priv->current_packet_idx - priv->num_echo_skb;
   539			WARN_ON(first_packet_idx != packet_idx);
   540		}
   541		tail_idx = priv->echo_skb_tail_idx;
   542		if (priv->num_echo_skb < pkts) {
   543			int pkts_drop = pkts - priv->num_echo_skb;
   544	
   545			if (net_ratelimit())
   546				netdev_err(netdev,
   547					   "Received %u loopback packets but have only %d echo skb. Dropping %d echo skb\n",
   548					   pkts, priv->num_echo_skb, pkts_drop);
   549			netdev->stats.tx_dropped += pkts_drop;
   550			pkts -= pkts_drop;
   551		}
   552		spin_unlock_irqrestore(&priv->echo_skb_spinlock, flags);
   553	
   554		for (i = 0; i < pkts; i++) {
   555			struct sk_buff *skb = priv->can.echo_skb[tail_idx];
   556			unsigned int frame_len = 0;
   557	
   558			if (skb)
   559				es58x_set_skb_timestamp(netdev, skb, tstamps[i]);
   560	
 > 561			netdev->stats.tx_bytes += can_get_echo_skb(netdev, tail_idx,
   562								   &frame_len);
   563			rx_total_frame_len += frame_len;
   564	
   565			es58x_add_skb_idx(priv, &tail_idx, 1);
   566		}
   567	
   568		spin_lock_irqsave(&priv->echo_skb_spinlock, flags);
   569		es58x_add_skb_idx(priv, &priv->echo_skb_tail_idx, pkts);
   570		priv->num_echo_skb -= pkts;
   571		spin_unlock_irqrestore(&priv->echo_skb_spinlock, flags);
   572	
   573		netdev_completed_queue(netdev, pkts, rx_total_frame_len);
   574		netdev->stats.tx_packets += pkts;
   575	
   576		priv->err_passive_before_rtx_success = 0;
   577		es58x_netif_wake_queue(netdev);
   578	
   579		return ret;
   580	}
   581	

---
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" (59583 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ