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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 10 Oct 2019 14:23:14 +0100
From:   Mark Brown <broonie@...nel.org>
To:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc:     spapothi@...eaurora.org, alsa-devel@...a-project.org,
        linux-kernel@...r.kernel.org, lgirdwood@...il.com,
        devicetree@...r.kernel.org, vkoul@...nel.org,
        pierre-louis.bossart@...ux.intel.com
Subject: Re: [PATCH v7 2/2] ASoC: codecs: add wsa881x amplifier support

On Thu, Oct 10, 2019 at 10:28:04AM +0100, Srinivas Kandagatla wrote:
> On 09/10/2019 17:35, Mark Brown wrote:
> > On Wed, Oct 09, 2019 at 09:51:08AM +0100, Srinivas Kandagatla wrote:
> > > +static const u8 wsa881x_reg_readable[WSA881X_CACHE_SIZE] = {

> > > +static bool wsa881x_readable_register(struct device *dev, unsigned int reg)
> > > +{
> > > +	return wsa881x_reg_readable[reg];

> > There's no bounds check and that array size is not...

> I converted this now to a proper switch statement as other drivers do.

> > > +static struct regmap_config wsa881x_regmap_config = {
> > > +	.reg_bits = 32,
> > > +	.val_bits = 8,
> > > +	.cache_type = REGCACHE_RBTREE,
> > > +	.reg_defaults = wsa881x_defaults,
> > > +	.num_reg_defaults = ARRAY_SIZE(wsa881x_defaults),
> > > +	.max_register = WSA881X_MAX_REGISTER,

> > ...what regmap has as max_register.  Uusually you'd render as a
> > switch statement (as you did for volatile) and let the compiler
> > figure out a sensible way to do the lookup.

> Sorry, I did not get your point here.

> Are you saying that we can skip max_register in this regmap config ?
> Then how would max_register in regmap be set?

I'm saying that you appear to be relying on max_register to
verify that you're not overflowing the array bounds but you
max_register is not set to the same thing as the array size.

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ