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:   Thu, 8 Jul 2021 19:59:12 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Carlos Bilbao <bilbao@...edu>
Cc:     davem@...emloft.net, Joe Perches <joe@...ches.com>,
        kuba@...nel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org
Subject: Re: [PATCH net-next v2] drivers: ethernet: tulip: Fix indentation of
 printk

On Thu, Jul 08, 2021 at 01:48:24PM -0400, Carlos Bilbao wrote:
> Fix indentation of printk that starts at the beginning of the line and does
> not have a KERN_<LEVEL>.
> 
> Signed-off-by: Carlos Bilbao <bilbao@...edu>
> ---
>  drivers/net/ethernet/dec/tulip/de4x5.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
> index b125d7faefdf..0d8ddfdd5c09 100644
> --- a/drivers/net/ethernet/dec/tulip/de4x5.c
> +++ b/drivers/net/ethernet/dec/tulip/de4x5.c
> @@ -3169,7 +3169,7 @@ dc2114x_autoconf(struct net_device *dev)
>  
>      default:
>  	lp->tcount++;
> -printk("Huh?: media:%02x\n", lp->media);
> +	printk(KERN_NOTICE "Huh?: media:%02x\n", lp->media);
>  	lp->media = INIT;
>  	break;
>      }

Since this is a network driver, and you have a net_device structure,
the best practice is to use

netdev_notice(dev, "Huh?: media:%02x\n", lp->media);

You could go through this driver and change all printk() to
netdev_dbg(), netdev_err(), netdev_info etc.  The advantage of these
calls is that they make it clear which network interface is outputting
the message.

Other subsystems have similar calls. If there are not subsystem
specific print functions, but you have a struct device, it is best to
use dev_err(), dev_dbg(), dev_info() etc. These functions will make it
clear which device is printing the message.

	      Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ