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, 1 Mar 2022 05:21:15 +0800
From:   kernel test robot <lkp@...el.com>
To:     wudaemon <wudaemon@....com>, davem@...emloft.net, kuba@...nel.org,
        m.grzeschik@...gutronix.de, chenhao288@...ilicon.com, arnd@...db.de
Cc:     kbuild-all@...ts.01.org, wudaemon@....com, shenyang39@...wei.com,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] net: ksz884x: use time_before in netdev_open for
 compatibility and remove static variable

Hi wudaemon,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on net/master soc/for-next linus/master v5.17-rc6 next-20220228]
[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/wudaemon/net-ksz884x-use-time_before-in-netdev_open-for-compatibility-and-remove-static-variable/20220301-003151
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b42a738e409b62f38a15ce7530e8290b00f823a4
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20220301/202203010501.zwejOIJA-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 11.2.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/5db9da911f33045f8dd202d40c20530211b48af0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review wudaemon/net-ksz884x-use-time_before-in-netdev_open-for-compatibility-and-remove-static-variable/20220301-003151
        git checkout 5db9da911f33045f8dd202d40c20530211b48af0
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=alpha SHELL=/bin/bash

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 >>):

   drivers/net/ethernet/micrel/ksz884x.c: In function 'prepare_hardware':
   drivers/net/ethernet/micrel/ksz884x.c:5363:23: warning: unused variable 'next_jiffies' [-Wunused-variable]
    5363 |         unsigned long next_jiffies = 0;
         |                       ^~~~~~~~~~~~
   In file included from include/linux/bitops.h:7,
                    from include/linux/kernel.h:22,
                    from include/linux/interrupt.h:6,
                    from drivers/net/ethernet/micrel/ksz884x.c:12:
   drivers/net/ethernet/micrel/ksz884x.c: In function 'netdev_open':
>> drivers/net/ethernet/micrel/ksz884x.c:5430:41: error: 'next_jiffies' undeclared (first use in this function)
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                                         ^~~~~~~~~~~~
   include/linux/typecheck.h:11:16: note: in definition of macro 'typecheck'
      11 |         typeof(x) __dummy2; \
         |                ^
   include/linux/jiffies.h:108:33: note: in expansion of macro 'time_after'
     108 | #define time_before(a,b)        time_after(b,a)
         |                                 ^~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:29: note: in expansion of macro 'time_before'
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                             ^~~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:41: note: each undeclared identifier is reported only once for each function it appears in
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                                         ^~~~~~~~~~~~
   include/linux/typecheck.h:11:16: note: in definition of macro 'typecheck'
      11 |         typeof(x) __dummy2; \
         |                ^
   include/linux/jiffies.h:108:33: note: in expansion of macro 'time_after'
     108 | #define time_before(a,b)        time_after(b,a)
         |                                 ^~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:29: note: in expansion of macro 'time_before'
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                             ^~~~~~~~~~~
   include/linux/typecheck.h:12:25: warning: comparison of distinct pointer types lacks a cast
      12 |         (void)(&__dummy == &__dummy2); \
         |                         ^~
   include/linux/jiffies.h:106:10: note: in expansion of macro 'typecheck'
     106 |          typecheck(unsigned long, b) && \
         |          ^~~~~~~~~
   include/linux/jiffies.h:108:33: note: in expansion of macro 'time_after'
     108 | #define time_before(a,b)        time_after(b,a)
         |                                 ^~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:29: note: in expansion of macro 'time_before'
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                             ^~~~~~~~~~~


vim +/next_jiffies +5430 drivers/net/ethernet/micrel/ksz884x.c

  5397	
  5398	/**
  5399	 * netdev_open - open network device
  5400	 * @dev:	Network device.
  5401	 *
  5402	 * This function process the open operation of network device.  This is caused
  5403	 * by the user command "ifconfig ethX up."
  5404	 *
  5405	 * Return 0 if successful; otherwise an error code indicating failure.
  5406	 */
  5407	static int netdev_open(struct net_device *dev)
  5408	{
  5409		struct dev_priv *priv = netdev_priv(dev);
  5410		struct dev_info *hw_priv = priv->adapter;
  5411		struct ksz_hw *hw = &hw_priv->hw;
  5412		struct ksz_port *port = &priv->port;
  5413		int i;
  5414		int p;
  5415		int rc = 0;
  5416	
  5417		priv->multicast = 0;
  5418		priv->promiscuous = 0;
  5419	
  5420		/* Reset device statistics. */
  5421		memset(&dev->stats, 0, sizeof(struct net_device_stats));
  5422		memset((void *) port->counter, 0,
  5423			(sizeof(u64) * OID_COUNTER_LAST));
  5424	
  5425		if (!(hw_priv->opened)) {
  5426			rc = prepare_hardware(dev);
  5427			if (rc)
  5428				return rc;
  5429			for (i = 0; i < hw->mib_port_cnt; i++) {
> 5430				if (time_before(next_jiffies, jiffies))
  5431					next_jiffies = jiffies + HZ * 2;
  5432				else
  5433					next_jiffies += HZ * 1;
  5434				hw_priv->counter[i].time = next_jiffies;
  5435				hw->port_mib[i].state = media_disconnected;
  5436				port_init_cnt(hw, i);
  5437			}
  5438			if (hw->ksz_switch)
  5439				hw->port_mib[HOST_PORT].state = media_connected;
  5440			else {
  5441				hw_add_wol_bcast(hw);
  5442				hw_cfg_wol_pme(hw, 0);
  5443				hw_clr_wol_pme_status(&hw_priv->hw);
  5444			}
  5445		}
  5446		port_set_power_saving(port, false);
  5447	
  5448		for (i = 0, p = port->first_port; i < port->port_cnt; i++, p++) {
  5449			/*
  5450			 * Initialize to invalid value so that link detection
  5451			 * is done.
  5452			 */
  5453			hw->port_info[p].partner = 0xFF;
  5454			hw->port_info[p].state = media_disconnected;
  5455		}
  5456	
  5457		/* Need to open the port in multiple device interfaces mode. */
  5458		if (hw->dev_count > 1) {
  5459			port_set_stp_state(hw, port->first_port, STP_STATE_SIMPLE);
  5460			if (port->first_port > 0)
  5461				hw_add_addr(hw, dev->dev_addr);
  5462		}
  5463	
  5464		port_get_link_speed(port);
  5465		if (port->force_link)
  5466			port_force_link_speed(port);
  5467		else
  5468			port_set_link_speed(port);
  5469	
  5470		if (!(hw_priv->opened)) {
  5471			hw_setup_intr(hw);
  5472			hw_enable(hw);
  5473			hw_ena_intr(hw);
  5474	
  5475			if (hw->mib_port_cnt)
  5476				ksz_start_timer(&hw_priv->mib_timer_info,
  5477					hw_priv->mib_timer_info.period);
  5478		}
  5479	
  5480		hw_priv->opened++;
  5481	
  5482		ksz_start_timer(&priv->monitor_timer_info,
  5483			priv->monitor_timer_info.period);
  5484	
  5485		priv->media_state = port->linked->state;
  5486	
  5487		set_media_state(dev, media_connected);
  5488		netif_start_queue(dev);
  5489	
  5490		return 0;
  5491	}
  5492	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists