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:	Tue, 26 Jan 2016 07:03:28 +0100
From:	Takashi Iwai <tiwai@...e.de>
To:	Lucas Tanure <tanure@...ux.com>
Cc:	Clemens Ladisch <clemens@...isch.de>,
	Jaroslav Kysela <perex@...ex.cz>, alsa-devel@...a-project.org,
	linux-kernel@...r.kernel.org
Subject: Re: [alsa-devel] [PATCH] ALSA: bebob: Use a signed return type for	get_formation_index

On Mon, 25 Jan 2016 22:30:23 +0100,
Lucas Tanure wrote:
> 
> The return type "unsigned int" was used by the get_formation_index function
> despite of the aspect that it will eventually return a negative	error code.
> So, change to signed int and get index by reference in the parameters.
> 
> Done with the help of Coccinelle.
> 
> Signed-off-by: Lucas Tanure <tanure@...ux.com>

Applied, thanks.


Takashi

> ---
>  sound/firewire/bebob/bebob_stream.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
> index 926e5dc..79940e3 100644
> --- a/sound/firewire/bebob/bebob_stream.c
> +++ b/sound/firewire/bebob/bebob_stream.c
> @@ -47,14 +47,15 @@ static const unsigned int bridgeco_freq_table[] = {
>  	[6] = 0x07,
>  };
>  
> -static unsigned int
> -get_formation_index(unsigned int rate)
> +static int
> +get_formation_index(unsigned int rate, unsigned int *index)
>  {
>  	unsigned int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(snd_bebob_rate_table); i++) {
>  		if (snd_bebob_rate_table[i] == rate)
> -			return i;
> +			*index = i;
> +			return 0;
>  	}
>  	return -EINVAL;
>  }
> @@ -425,7 +426,9 @@ make_both_connections(struct snd_bebob *bebob, unsigned int rate)
>  		goto end;
>  
>  	/* confirm params for both streams */
> -	index = get_formation_index(rate);
> +	err = get_formation_index(rate, &index);
> +	if (err < 0)
> +		goto end;
>  	pcm_channels = bebob->tx_stream_formations[index].pcm;
>  	midi_channels = bebob->tx_stream_formations[index].midi;
>  	err = amdtp_am824_set_parameters(&bebob->tx_stream, rate,
> -- 
> 2.7.0
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@...a-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

Powered by blists - more mailing lists