All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Karl Asseily" <karl@asseily.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v4 3/4] ASoC: es9039q2m: add ESS Technology ES9039Q2M codec driver
Date: Fri, 18 Sep 2026 18:39:31 +0000	[thread overview]
Message-ID: <20260918183931.CE0831F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260918182317.143223-4-karl@asseily.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] ASoC: es9039q2m: FIR coefficient upload corrupts data with TLV header
- [Low] i2c: positional initializer used for i2c_device_id
--

commit 3aee2b23f8220349aa3bc4bfbb0d2fa6dfeb5b60
Author: Karl Asseily <karl@asseily.com>

ASoC: es9039q2m: add ESS Technology ES9039Q2M codec driver

This commit introduces a new ALSA SoC codec driver for the ESS Technology
ES9039Q2M 32-bit audio DAC. It supports software mode over I2C, implementing
programmable FIR filters, custom routing, and DSD/DoP stream detection.

> diff --git a/sound/soc/codecs/es9039q2m.c b/sound/soc/codecs/es9039q2m.c
> new file mode 100644
> index 0000000000000..4e9f86cb78606
> --- /dev/null
> +++ b/sound/soc/codecs/es9039q2m.c

[ ... ]

> +static int es9039_fir_put(struct snd_kcontrol *kcontrol,
> +			  const unsigned int __user *bytes, unsigned int size)
> +{
> +	struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
> +	struct es9039q2m_priv *priv = snd_soc_component_get_drvdata(c);
> +	struct soc_bytes_ext *be = (void *)kcontrol->private_value;
> +	struct es9039_fir_ctl *p = container_of(be, struct es9039_fir_ctl, be);
> +	unsigned int idx = p->stage_4x ? 1 : 0;
> +	u8 *buf;
> +	int ret;
> +
> +	if (size != p->taps * ES9039_COEFF_BYTES)
> +		return -EINVAL;
> +
> +	buf = memdup_user(bytes, size);

[Severity: High]
Does this copy include the ALSA TLV header along with the coefficient payload?

When userspace writes coefficients via the ALSA TLV control, snd_ctl_tlv_ioctl
passes the TLV array down to snd_soc_bytes_tlv_callback. This array starts
with a 2-word header containing the type and length.

Because memdup_user starts from the very beginning of the bytes array without
skipping this 8-byte header, the hardware's coefficient RAM might receive the
header data instead of the actual coefficients, and the last 8 bytes of the
intended payload would be truncated.

> +	if (IS_ERR(buf))
> +		return PTR_ERR(buf);

[ ... ]

> +static const struct i2c_device_id es9039q2m_i2c_id[] = {
> +	{ "es9039q2m" },

[Severity: Low]
This isn't a functional bug, but should this use a named initializer to
conform to the I2C subsystem guidelines for i2c_device_id arrays? For
example, using { .name = "es9039q2m" }.

> +	{ }
> +};
> +MODULE_DEVICE_TABLE(i2c, es9039q2m_i2c_id);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260918182317.143223-1-karl@asseily.com?part=3

  reply	other threads:[~2026-09-18 18:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 18:23 [PATCH v4 0/4] ASoC: add ESS Technology ES9039Q2M codec driver Karl Asseily
2026-09-18 18:23 ` [PATCH v4 1/4] dt-bindings: vendor-prefixes: add ESS Technology Karl Asseily
2026-09-18 18:23 ` [PATCH v4 2/4] ASoC: dt-bindings: add ESS Technology ES9039Q2M Karl Asseily
2026-09-18 18:23 ` [PATCH v4 3/4] ASoC: es9039q2m: add ESS Technology ES9039Q2M codec driver Karl Asseily
2026-09-18 18:39   ` sashiko-bot [this message]
2026-09-19  5:27     ` Karl Asseily
2026-09-18 18:23 ` [PATCH v4 4/4] MAINTAINERS: add entry for the " Karl Asseily
2026-09-18 21:20 ` [PATCH v4 0/4] ASoC: add ESS Technology " Mark Brown

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=20260918183931.CE0831F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=karl@asseily.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.