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:   Thu, 16 Sep 2021 08:18:15 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Ariel Elior <aelior@...vell.com>, GR-everest-linux-l2@...vell.com,
        "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net-next] qede: cleanup printing in qede_log_probe()

On Thu, 16 Sep 2021 16:54:15 +0300 Dan Carpenter wrote:
> This code use strlen(buf) to find the number of characters printed.
> That's sort of ugly and unnecessary because we can just use the
> return from scnprintf() instead.
> 
> Also since strlen() does not count the NUL terminator, that means
> "QEDE_FW_VER_STR_SIZE - strlen(buf)" is never going to be zero so
> that condition can be removed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
>  drivers/net/ethernet/qlogic/qede/qede_main.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
> index 9837bdb89cd4..e188ff5277a5 100644
> --- a/drivers/net/ethernet/qlogic/qede/qede_main.c
> +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
> @@ -1087,9 +1087,9 @@ static void qede_log_probe(struct qede_dev *edev)
>  {
>  	struct qed_dev_info *p_dev_info = &edev->dev_info.common;
>  	u8 buf[QEDE_FW_VER_STR_SIZE];
> -	size_t left_size;
> +	int off;
>  
> -	snprintf(buf, QEDE_FW_VER_STR_SIZE,
> +	off = scnprintf(buf, QEDE_FW_VER_STR_SIZE,
>  		 "Storm FW %d.%d.%d.%d, Management FW %d.%d.%d.%d",
>  		 p_dev_info->fw_major, p_dev_info->fw_minor, p_dev_info->fw_rev,
>  		 p_dev_info->fw_eng,

Why not adjust the continuation lines? checkpatch is not happy.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ