From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Conner Knox <connerknoxpublic@gmail.com>, linux-sound@vger.kernel.org
Subject: Re: [bug report] ALSA: usb-audio: Add quirk to enable Avid Mbox 3 support
Date: Mon, 02 Dec 2024 13:16:36 +0100 [thread overview]
Message-ID: <874j3mwa8r.wl-tiwai@suse.de> (raw)
In-Reply-To: <47c421ab-f50a-486f-a7d9-da4df8afde1b@stanley.mountain>
On Mon, 02 Dec 2024 10:04:41 +0100,
Dan Carpenter wrote:
>
> On Sat, Nov 30, 2024 at 01:01:49PM +0300, Dan Carpenter wrote:
> > Hello Conner Knox,
> >
> > Commit b01104fc62b6 ("ALSA: usb-audio: Add quirk to enable Avid Mbox
> > 3 support") from Aug 18, 2022 (linux-next), leads to the following
> > Smatch static checker warning:
> >
> > sound/usb/quirks.c:1275 snd_usb_mbox3_boot_quirk() error: doing dma on the stack (&new_device_descriptor)
> > sound/usb/quirks.c:569 snd_usb_extigy_boot_quirk() error: doing dma on the stack (&new_device_descriptor)
> > sound/usb/quirks.c:944 snd_usb_mbox2_boot_quirk() error: doing dma on the stack (&new_device_descriptor)
> >
> > sound/usb/quirks.c
> > 1259 static int snd_usb_mbox3_boot_quirk(struct usb_device *dev)
> > 1260 {
> > 1261 struct usb_host_config *config = dev->actconfig;
> > 1262 struct usb_device_descriptor new_device_descriptor;
> > ^^^^^^^^^^^^^^^^^^^^^^
> > 1263 int err;
> > 1264 int descriptor_size;
> > 1265
> > 1266 descriptor_size = le16_to_cpu(get_cfg_desc(config)->wTotalLength);
> > 1267
> > 1268 if (descriptor_size != MBOX3_DESCRIPTOR_SIZE) {
> > 1269 dev_err(&dev->dev, "MBOX3: Invalid descriptor size=%d.\n", descriptor_size);
> > 1270 return -ENODEV;
> > 1271 }
> > 1272
> > 1273 dev_dbg(&dev->dev, "MBOX3: device initialised!\n");
> > 1274
> > --> 1275 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
> > 1276 &new_device_descriptor, sizeof(new_device_descriptor));
> > ^^^^^^^^^^^^^^^^^^^^^^
> > The comments in usb_fill_control_urb() say this has to be "suitable for DMA"
> > but this is stack data. It has to be allocated with kmalloc() to be suitable.
> >
> > I don't know why I'm only seeing this warning now two years later...
> >
>
> My script looks at the line number for the function and not for the buffer so it
> blamed the wrong patch.
>
> Don't stress about this, I'll send a fix in a few hours.
Yep, the culprit is rather the recent fix commit b909df18ce2a:
ALSA: usb-audio: Fix potential out-of-bound accesses for Extigy and
Mbox devices
thanks,
Takashi
prev parent reply other threads:[~2024-12-02 12:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-30 10:01 [bug report] ALSA: usb-audio: Add quirk to enable Avid Mbox 3 support Dan Carpenter
2024-12-02 9:04 ` Dan Carpenter
2024-12-02 12:16 ` Takashi Iwai [this message]
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=874j3mwa8r.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=connerknoxpublic@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=linux-sound@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox