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:	Thu, 19 Dec 2013 16:48:24 +0000
From:	Lee Jones <lee.jones@...aro.org>
To:	Takashi Iwai <tiwai@...e.de>
Cc:	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linus.walleij@...aro.org, broonie@...nel.org,
	alsa-devel@...a-project.org
Subject: Re: [PATCH 02/11] ASoC: ab8500: Revert back to find_next_bit()

> > Commit '166a34d ASoC: ab8500: Fix invalid cast to long pointer'
> > rather carelessly converts find_next_bit() to fls() (find last
> > bit set), which are not the same.
> 
> Does it break on the real machines?

It does, that's how I found the bug.

> fls() behaves differently from find_next_bit(), of course, but in this
> case, it should work same in the end, since there are at most two
> bits.

Unfortunately it doesn't work at all. This patch brings audio back to
a working state. It took me the best part of a day to track down the
issue. :(

> > Although this implementation may not be portable, the alternative
> > breaks audio on anything using the AB8500 CODEC, which is a much
> > greater evil. Besides, this driver will never run on anything
> > else.
> > 
> > Cc: Takashi Iwai <tiwai@...e.de>
> > Signed-off-by: Lee Jones <lee.jones@...aro.org>
> > ---
> >  sound/soc/codecs/ab8500-codec.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
> > index 1ad92cb..51ae3e9 100644
> > --- a/sound/soc/codecs/ab8500-codec.c
> > +++ b/sound/soc/codecs/ab8500-codec.c
> > @@ -2322,7 +2322,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
> >  		slot = ffs(tx_mask);
> >  		snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot);
> >  		snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot);
> > -		slot = fls(tx_mask);
> > +		slot = find_next_bit((unsigned long *)&tx_mask, 32, slot + 1);
> >  		snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot);
> >  		snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot);
> >  		break;
> > @@ -2364,7 +2364,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
> >  				AB8500_ADSLOTSEL(slot),
> >  				AB8500_MASK_SLOT(slot),
> >  				AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot));
> > -		slot = fls(rx_mask);
> > +		slot = find_next_bit((unsigned long *)&rx_mask, 32, slot + 1);
> >  		snd_soc_update_bits(codec,
> >  				AB8500_ADSLOTSEL(slot),
> >  				AB8500_MASK_SLOT(slot),

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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