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]
Message-ID: <77247fbc-152a-517f-2500-ce761b7afa6a@intel.com>
Date:   Thu, 30 Jul 2020 14:20:46 -0700
From:   Jacob Keller <jacob.e.keller@...el.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
        intel-wired-lan@...ts.osuosl.org,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org
Subject: Re: [PATCH v1] ice: devlink: use %*phD to print small buffer



On 7/30/2020 9:04 AM, Andy Shevchenko wrote:
> Use %*phD format to print small buffer as hex string.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Ah nice. I swear I looked for a printk format to do this and didn't find
one. But it's been there since 2012.. so I guess I just missed it.

Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>

I also tested this on my system to make sure it gives the same output
for the serial value, so I guess also:

Tested-by: Jacob Keller <jacob.e.keller@...el.com>

Thanks!

> ---
>  drivers/net/ethernet/intel/ice/ice_devlink.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
> index dbbd8b6f9d1a..a9105ad5b983 100644
> --- a/drivers/net/ethernet/intel/ice/ice_devlink.c
> +++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
> @@ -13,9 +13,7 @@ static int ice_info_get_dsn(struct ice_pf *pf, char *buf, size_t len)
>  	/* Copy the DSN into an array in Big Endian format */
>  	put_unaligned_be64(pci_get_dsn(pf->pdev), dsn);
>  
> -	snprintf(buf, len, "%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x",
> -		 dsn[0], dsn[1], dsn[2], dsn[3],
> -		 dsn[4], dsn[5], dsn[6], dsn[7]);
> +	snprintf(buf, len, "%8phD", dsn);
>  
>  	return 0;
>  }
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ