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]
Date:   Sat, 5 Sep 2020 13:29:00 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Armin Wolf <W_Armin@....de>
Cc:     davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH 1/3 v4 net-next] lib8390: Fix coding-style issues and
 remove verion printing

On Sat, 5 Sep 2020 19:43:17 +0200 Armin Wolf wrote:
> Fix various checkpatch warnings.
> 
> Remove version printing so modules including lib8390 do not
> have to provide a global version string for successful
> compilation.
> 
> Replace pr_cont() with SMP-safe construct.
> 
> Signed-off-by: Armin Wolf <W_Armin@....de>

> @@ -106,90 +105,86 @@ static void ei_receive(struct net_device *dev);
>  static void ei_rx_overrun(struct net_device *dev);
> 
>  /* Routines generic to NS8390-based boards. */
> -static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
> -								int start_page);
> +static void NS8390_trigger_send(struct net_device *dev,
> +				unsigned int length, int start_page);

Please note that max line length was recently update to 120 (I think),
so the line wrap changes here are not necessary.

>  static void do_set_multicast_list(struct net_device *dev);
>  static void __NS8390_init(struct net_device *dev, int startp);
> 
> -static unsigned version_printed;
>  static u32 msg_enable;
> +
>  module_param(msg_enable, uint, 0444);
>  MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
> 
> -/*
> - *	SMP and the 8390 setup.
> +/* SMP and the 8390 setup.
>   *
> - *	The 8390 isn't exactly designed to be multithreaded on RX/TX. There is
> - *	a page register that controls bank and packet buffer access. We guard
> - *	this with ei_local->page_lock. Nobody should assume or set the page other
> - *	than zero when the lock is not held. Lock holders must restore page 0
> - *	before unlocking. Even pure readers must take the lock to protect in
> - *	page 0.
> + * The 8390 isn't exactly designed to be multithreaded on RX/TX. There is
> + * a page register that controls bank and packet buffer access. We guard
> + * this with ei_local->page_lock. Nobody should assume or set the page other
> + * than zero when the lock is not held. Lock holders must restore page 0
> + * before unlocking. Even pure readers must take the lock to protect in
> + * page 0.

Realigning the start of line like this is not worth it, please leave it
be. The kernel is full of indented comments.

> -	/*
> -	 *	Grab the page lock so we own the register set, then call
> -	 *	the init function.
> +	/* Grab the page lock so we own the register set, then call
> +	 * the init function.
>  	 */

This as well, etc..

> @@ -532,30 +529,22 @@ static void ei_tx_err(struct net_device *dev)
>  {
>  	unsigned long e8390_base = dev->base_addr;
>  	/* ei_local is used on some platforms via the EI_SHIFT macro */
> -	struct ei_device *ei_local __maybe_unused = netdev_priv(dev);
> -	unsigned char txsr = ei_inb_p(e8390_base+EN0_TSR);
> -	unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU);
> -
> -#ifdef VERBOSE_ERROR_DUMP
> -	netdev_dbg(dev, "transmitter error (%#2x):", txsr);
> -	if (txsr & ENTSR_ABT)
> -		pr_cont(" excess-collisions ");
> -	if (txsr & ENTSR_ND)
> -		pr_cont(" non-deferral ");
> -	if (txsr & ENTSR_CRS)
> -		pr_cont(" lost-carrier ");
> -	if (txsr & ENTSR_FU)
> -		pr_cont(" FIFO-underrun ");
> -	if (txsr & ENTSR_CDH)
> -		pr_cont(" lost-heartbeat ");
> -	pr_cont("\n");
> -#endif
> -
> +	struct ei_device *ei_local = netdev_priv(dev);
> +	unsigned char txsr = ei_inb_p(e8390_base + EN0_TSR);
> +	unsigned char tx_was_aborted = txsr & (ENTSR_ABT + ENTSR_FU);
> +
> +	if (netif_msg_tx_err(ei_local)) {
> +		netdev_err(dev, "Transmitter error %#2x ( %s%s%s%s%s)", txsr,
> +			   (txsr & ENTSR_ABT) ? "excess-collisions " : "",
> +			   (txsr & ENTSR_ND) ? "non-deferral " : "",
> +			   (txsr & ENTSR_CRS) ? "lost-carrier " : "",
> +			   (txsr & ENTSR_FU) ? "FIFO-underrun " : "",
> +			   (txsr & ENTSR_CDH) ? "lost-heartbeat " : "");
> +	}

The pr_cont() -> netdev_err() changes should be a separate patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ