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:   Mon, 21 May 2018 23:12:22 +0300
From:   Luca Coelho <luca@...lho.fi>
To:     Yisheng Xie <xieyisheng1@...wei.com>, linux-kernel@...r.kernel.org
Cc:     Kalle Valo <kvalo@...eaurora.org>,
        Intel Linux Wireless <linuxwifi@...el.com>,
        Johannes Berg <johannes.berg@...el.com>,
        Emmanuel Grumbach <emmanuel.grumbach@...el.com>,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 07/33] iwlwifi: mvm: use match_string() helper

On Mon, 2018-05-21 at 19:57 +0800, Yisheng Xie wrote:
> match_string() returns the index of an array for a matching string,
> which can be used intead of open coded variant.
> 
> Cc: Kalle Valo <kvalo@...eaurora.org>
> Cc: Intel Linux Wireless <linuxwifi@...el.com>
> Cc: Johannes Berg <johannes.berg@...el.com>
> Cc: Emmanuel Grumbach <emmanuel.grumbach@...el.com>
> Cc: linux-wireless@...r.kernel.org
> Cc: netdev@...r.kernel.org
> Signed-off-by: Yisheng Xie <xieyisheng1@...wei.com>
> ---
>  drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> index 0e6401c..e8249a6 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> @@ -671,14 +671,9 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file
> *file, char __user *user_buf,
>  	};
>  	int ret, bt_force_ant_mode;
>  
> -	for (bt_force_ant_mode = 0;
> -	     bt_force_ant_mode < ARRAY_SIZE(modes_str);
> -	     bt_force_ant_mode++) {
> -		if (!strcmp(buf, modes_str[bt_force_ant_mode]))
> -			break;
> -	}
> -
> -	if (bt_force_ant_mode >= ARRAY_SIZE(modes_str))
> +	bt_force_ant_mode = match_string(modes_str,
> +					 ARRAY_SIZE(modes_str),
> buf);
> +	if (bt_force_ant_mode < 0)
>  		return -EINVAL;
>  
>  	ret = 0;

Looks fine, I'll push this to our internal tree for review and take a
closer look at what the match_string() function does exactly.

Thanks for the patch.

--
Cheers,
Luca.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ