All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Alex Henrie <alexhenrie24@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 9/9] conf: remove dead code from get_hexachar
Date: Sun, 27 Dec 2020 09:37:27 +0100	[thread overview]
Message-ID: <s5hwnx3ejaw.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201226213547.175071-10-alexhenrie24@gmail.com>

On Sat, 26 Dec 2020 22:35:47 +0100,
Alex Henrie wrote:
> 
> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
> ---
>  src/conf.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/src/conf.c b/src/conf.c
> index 44d1bfde..970ad643 100644
> --- a/src/conf.c
> +++ b/src/conf.c
> @@ -877,16 +877,9 @@ static int get_nonwhite(input_t *input)
>  
>  static inline int get_hexachar(input_t *input)
>  {
> -	int c, num = 0;
> -
> +	int c;
>  	c = get_char(input);
> -	if (c >= '0' && c <= '9') num |= (c - '0') << 4;
> -	else if (c >= 'a' && c <= 'f') num |= (c - 'a') << 4;
> -	else if (c >= 'A' && c <= 'F') num |= (c - 'A') << 4;
>  	c = get_char(input);
> -	if (c >= '0' && c <= '9') num |= (c - '0') << 0;
> -	else if (c >= 'a' && c <= 'f') num |= (c - 'a') << 0;
> -	else if (c >= 'A' && c <= 'F') num |= (c - 'A') << 0;
>  	return c;

The current code is obviously wrong and the suggested fix goes even to
a wronger direction :)  The function should return num instead.

I wonder how this did't hit any problem, so far.  Maybe 0x prefix was
rarely used, fortunately.


thanks,

Takashi

  reply	other threads:[~2020-12-27  8:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-26 21:35 [PATCH 0/9] scan-build fixes Alex Henrie
2020-12-26 21:35 ` [PATCH 1/9] conf: fix use after free in _snd_config_load_with_include Alex Henrie
2020-12-27  8:38   ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 2/9] ucm: fix bad frees in get_list0 and get_list20 Alex Henrie
2020-12-27  8:38   ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 3/9] rawmidi: fix memory leak in snd_rawmidi_virtual_open Alex Henrie
2020-12-27  8:38   ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 4/9] confmisc: fix memory leak in snd_func_concat Alex Henrie
2020-12-27  8:26   ` Takashi Iwai
2020-12-28  1:45     ` Alex Henrie
2020-12-26 21:35 ` [PATCH 5/9] timer: fix sizeof operator mismatch in snd_timer_query_hw_open Alex Henrie
2020-12-27  8:39   ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 6/9] pcm: remove dead assignments from snd_pcm_rate_(commit_area|grab_next_period) Alex Henrie
2020-12-27  8:39   ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 7/9] pcm_multi: remove dead assignment from _snd_pcm_multi_open Alex Henrie
2020-12-27  8:39   ` Takashi Iwai
2020-12-26 21:35 ` [PATCH 8/9] pcm: fix undefined bit shift in bad_pcm_state Alex Henrie
2020-12-27  8:34   ` Takashi Iwai
2020-12-27 12:36     ` Jaroslav Kysela
2020-12-28  1:45       ` Alex Henrie
2020-12-26 21:35 ` [PATCH 9/9] conf: remove dead code from get_hexachar Alex Henrie
2020-12-27  8:37   ` Takashi Iwai [this message]
2020-12-27 12:25     ` Jaroslav Kysela
2020-12-28  1:42       ` Alex Henrie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hwnx3ejaw.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alexhenrie24@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.