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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 03 Dec 2018 10:32:52 -0800
From:   Joe Perches <joe@...ches.com>
To:     Brian Norris <briannorris@...omium.org>,
        Kalle Valo <kvalo@...eaurora.org>
Cc:     linux-kernel@...r.kernel.org,
        Amitkumar Karwar <amitkarwar@...il.com>,
        Nishant Sarmukadam <nishants@...vell.com>,
        Ganapathi Bhat <gbhat@...vell.com>,
        Xinming Hu <huxinming820@...il.com>,
        linux-wireless@...r.kernel.org
Subject: Re: [PATCH 1/3] mwifiex: debugfs: correct histogram spacing,
 formatting

On Fri, 2018-11-30 at 14:53 -0800, Brian Norris wrote:
> Currently, snippets of this file look like:
> 
> rx rates (in Mbps): 0=1M   1=2M2=5.5M  3=11M   4=6M   5=9M  6=12M
> 7=18M  8=24M  9=36M  10=48M  11=54M12-27=MCS0-15(BW20) 28-43=MCS0-15(BW40)
> 44-53=MCS0-9(VHT:BW20)54-63=MCS0-9(VHT:BW40)64-73=MCS0-9(VHT:BW80)
> ...
> noise_flr[--96dBm] = 22
> noise_flr[--95dBm] = 149
> noise_flr[--94dBm] = 9
> noise_flr[--93dBm] = 2
> 
> We're missing some spaces, and we're adding a minus sign ('-') on values
> that are already negative signed integers.
> 
> Signed-off-by: Brian Norris <briannorris@...omium.org>
> ---
>  drivers/net/wireless/marvell/mwifiex/debugfs.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c
> index cce70252fd96..65e48e16cb49 100644
> --- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
> +++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
> @@ -273,14 +273,14 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf,
>  		     "total samples = %d\n",
>  		     atomic_read(&phist_data->num_samples));
>  
> -	p += sprintf(p, "rx rates (in Mbps): 0=1M   1=2M");
> +	p += sprintf(p, "rx rates (in Mbps): 0=1M   1=2M ");
>  	p += sprintf(p, "2=5.5M  3=11M   4=6M   5=9M  6=12M\n");
> -	p += sprintf(p, "7=18M  8=24M  9=36M  10=48M  11=54M");
> +	p += sprintf(p, "7=18M  8=24M  9=36M  10=48M  11=54M ");
>  	p += sprintf(p, "12-27=MCS0-15(BW20) 28-43=MCS0-15(BW40)\n");
> 

It's be smaller object code and more intelligible source to use
a single coalesced string with one sprintf

>  	if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info)) {
> -		p += sprintf(p, "44-53=MCS0-9(VHT:BW20)");
> -		p += sprintf(p, "54-63=MCS0-9(VHT:BW40)");
> +		p += sprintf(p, "44-53=MCS0-9(VHT:BW20) ");
> +		p += sprintf(p, "54-63=MCS0-9(VHT:BW40) ");
>  		p += sprintf(p, "64-73=MCS0-9(VHT:BW80)\n\n");
>  	} else {
>  		p += sprintf(p, "\n");
> @@ -310,7 +310,7 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf,y 
>  	for (i = 0; i < MWIFIEX_MAX_NOISE_FLR; i++) {
>  		value = atomic_read(&phist_data->noise_flr[i]);
>  		if (value)
> -			p += sprintf(p, "noise_flr[-%02ddBm] = %d\n",
> +			p += sprintf(p, "noise_flr[%02ddBm] = %d\n",
>  				(int)(i-128), value);
>  	}
>  	for (i = 0; i < MWIFIEX_MAX_SIG_STRENGTH; i++) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ