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:	Wed, 18 Jan 2012 18:18:00 +0100
From:	walter harms <wharms@....de>
To:	Julia Lawall <Julia.Lawall@...6.fr>
CC:	Greg Kroah-Hartman <gregkh@...e.de>,
	kernel-janitors@...r.kernel.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] drivers/staging: adjust double test



Am 12.01.2012 22:33, schrieb Julia Lawall:
> From: Julia Lawall <Julia.Lawall@...6.fr>
> 
> Rewrite a duplicated test to test the correct value
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression E;
> @@
> 
> (
> * E
>   || ... || E
> |
> * E
>   && ... && E
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@...6.fr>
> 
> ---
>  drivers/staging/gma500/mdfld_dsi_pkg_sender.c |    6 ++----
>  drivers/staging/rtl8192e/rtllib_rx.c          |    2 +-
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
> index 6c5061f..13979b5 100644
> --- a/drivers/staging/rtl8192e/rtllib_rx.c
> +++ b/drivers/staging/rtl8192e/rtllib_rx.c
> @@ -2453,7 +2453,7 @@ static inline void update_network(struct rtllib_network *dst,
>  	if (src->wmm_param[0].ac_aci_acm_aifsn ||
>  	   src->wmm_param[1].ac_aci_acm_aifsn ||
>  	   src->wmm_param[2].ac_aci_acm_aifsn ||
> -	   src->wmm_param[1].ac_aci_acm_aifsn)
> +	   src->wmm_param[3].ac_aci_acm_aifsn)
>  		memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
>  
>  	dst->SignalStrength = src->SignalStrength;
> diff --git a/drivers/staging/gma500/mdfld_dsi_pkg_sender.c b/drivers/staging/gma500/mdfld_dsi_pkg_sender.c
> index 9b96a5c..3a9f44f 100644
> --- a/drivers/staging/gma500/mdfld_dsi_pkg_sender.c
> +++ b/drivers/staging/gma500/mdfld_dsi_pkg_sender.c
> @@ -1249,8 +1249,7 @@ int mdfld_dsi_read_gen_hs(struct mdfld_dsi_pkg_sender *sender,
>  			u32 *data,
>  			u16 len)
>  {
> -	if (!sender || !data || param_num < 0 || param_num > 2
> -		|| !data || !len) {
> +	if (!sender || param_num < 0 || param_num > 2 || !data || !len) {
>  		DRM_ERROR("Invalid parameters\n");
>  		return -EINVAL;
>  	}
> @@ -1267,8 +1266,7 @@ int mdfld_dsi_read_gen_lp(struct mdfld_dsi_pkg_sender *sender,
>  			u32 *data,
>  			u16 len)
>  {
> -	if (!sender || !data || param_num < 0 || param_num > 2
> -		|| !data || !len) {
> +	if (!sender || param_num < 0 || param_num > 2 || !data || !len) {
>  		DRM_ERROR("Invalid parameters\n");
>  		return -EINVAL;
>  	}
> 
> --
Hi,
this is obviously correct but what is about readability ?
would it be an option to break it into two line (or two if) like:
  if (!sender || !data || !len)
	if ( param_num < 0 || param_num > 2 )

re,
 wh


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ