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:   Fri, 3 Mar 2017 17:03:09 +0100 (CET)
From:   Julia Lawall <julia.lawall@...6.fr>
To:     Arushi Singhal <arushisinghal19971997@...il.com>
cc:     w.d.hubbs@...il.com, Chris Brannon <chris@...-brannons.com>,
        Kirk Reiser <kirk@...sers.ca>,
        Samuel Thibault <samuel.thibault@...-lyon.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        speakup@...ux-speakup.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org, outreachy-kernel@...glegroups.com
Subject: Re: [Outreachy kernel] [PATCH] staging: speakup: else is not generally
 useful after a break or return



On Fri, 3 Mar 2017, Arushi Singhal wrote:

> fixed checkpatch.pl warning: else is not generally useful after a break
> or return.
> Removed the else without affecting the logic.
> Dead code is also eliminated.

The chhange is not correct.  There is a big chain of if/else if.  The if
(type == KT_LATIN) can reach the code at the end of the file.

julia

>
> Signed-off-by: Arushi Singhal <arushisinghal19971997@...il.com>
> ---
>  drivers/staging/speakup/keyhelp.c | 53 ++++++++++++++-------------------------
>  1 file changed, 19 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/staging/speakup/keyhelp.c b/drivers/staging/speakup/keyhelp.c
> index 4e6e5daba50c..ad3efded37c1 100644
> --- a/drivers/staging/speakup/keyhelp.c
> +++ b/drivers/staging/speakup/keyhelp.c
> @@ -176,43 +176,28 @@ int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key)
>  		synth_printf("%s\n", spk_msg_get(MSG_HELP_INFO));
>  		build_key_data(); /* rebuild each time in case new mapping */
>  		return 1;
> -	} else {
> -		name = NULL;
> -		if ((type != KT_SPKUP) && (key > 0) && (key <= num_key_names)) {
> -			synth_printf("%s\n",
> -				     spk_msg_get(MSG_KEYNAMES_START + key - 1));
> -			return 1;
> -		}
> -		for (i = 0; funcvals[i] != 0 && !name; i++) {
> -			if (ch == funcvals[i])
> -				name = spk_msg_get(MSG_FUNCNAMES_START + i);
> -		}
> -		if (!name)
> -			return -1;
> -		kp = spk_our_keys[key] + 1;
> -		for (i = 0; i < nstates; i++) {
> -			if (ch == kp[i])
> -				break;
> -		}
> -		key += (state_tbl[i] << 8);
> -		say_key(key);
> -		synth_printf(spk_msg_get(MSG_KEYDESC), name);
> -		synth_printf("\n");
> -		return 1;
>  	}
> -	name = spk_msg_get(MSG_FUNCNAMES_START + cur_item);
> -	func = funcvals[cur_item];
> -	synth_printf("%s", name);
> -	if (key_offsets[func] == 0) {
> -		synth_printf(" %s\n", spk_msg_get(MSG_IS_UNASSIGNED));
> +
> +	name = NULL;
> +	if ((type != KT_SPKUP) && (key > 0) && (key <= num_key_names)) {
> +		synth_printf("%s\n",
> +			     spk_msg_get(MSG_KEYNAMES_START + key - 1));
>  		return 1;
>  	}
> -	p_keys = key_data + key_offsets[func];
> -	for (n = 0; p_keys[n]; n++) {
> -		val = p_keys[n];
> -		if (n > 0)
> -			synth_printf("%s ", spk_msg_get(MSG_DISJUNCTION));
> -		say_key(val);
> +	for (i = 0; funcvals[i] != 0 && !name; i++) {
> +		if (ch == funcvals[i])
> +			name = spk_msg_get(MSG_FUNCNAMES_START + i);
> +	}
> +	if (!name)
> +		return -1;
> +	kp = spk_our_keys[key] + 1;
> +	for (i = 0; i < nstates; i++) {
> +		if (ch == kp[i])
> +			break;
>  	}
> +	key += (state_tbl[i] << 8);
> +	say_key(key);
> +	synth_printf(spk_msg_get(MSG_KEYDESC), name);
> +	synth_printf("\n");
>  	return 1;
>  }
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@...glegroups.com.
> To post to this group, send email to outreachy-kernel@...glegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170303155557.GA23744%40arushi-HP-Pavilion-Notebook.
> For more options, visit https://groups.google.com/d/optout.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ