Linux-Next Archive on lore.kernel.org
 help / color / Atom feed
* Coverity: ALSA: usb-audio: Error handling issues
@ 2021-04-05 18:02 coverity-bot
  0 siblings, 0 replies; only message in thread
From: coverity-bot @ 2021-04-05 18:02 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Daniel Mack, Clemens Ladisch, Gustavo A. R. Silva, linux-next

Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20210401 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Fri Mar 5 08:17:14 2010 +0100
    e5779998bf8b ("ALSA: usb-audio: refactor code")
  Thu Jun 27 21:59:49 2013 +0200
    b1ce7ba619d9 ("ALSA: usb-audio: claim autodetected PCM interfaces all at once")

Coverity reported the following:

*** CID 1475943:  Error handling issues  (CHECKED_RETURN)
/sound/usb/quirks.c: 430 in create_autodetect_quirks()
424     		    get_iface_desc(iface->altsetting)->bInterfaceClass !=
425     							USB_CLASS_VENDOR_SPEC)
426     			continue;
427
428     		err = create_autodetect_quirk(chip, iface, driver);
429     		if (err >= 0)
vvv     CID 1475943:  Error handling issues  (CHECKED_RETURN)
vvv     Calling "usb_driver_claim_interface" without checking return value (as is done elsewhere 16 out of 20 times).
430     			usb_driver_claim_interface(driver, iface, (void *)-1L);
431     	}
432
433     	return 0;
434     }
435

*** CID 1475944:  Error handling issues  (CHECKED_RETURN)
/sound/usb/card.c: 206 in snd_usb_create_stream()
200     		dev_err(&dev->dev, "low speed audio streaming not supported\n");
201     		return -EINVAL;
202     	}
203
204     	if (! snd_usb_parse_audio_interface(chip, interface)) {
205     		usb_set_interface(dev, interface, 0); /* reset the current interface */
vvv     CID 1475944:  Error handling issues  (CHECKED_RETURN)
vvv     Calling "usb_driver_claim_interface" without checking return value (as is done elsewhere 16 out of 20 times).
206     		usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
207     	}
208
209     	return 0;
210     }
211

*** CID 1475945:  Error handling issues  (CHECKED_RETURN)
/sound/usb/quirks.c: 59 in create_composite_quirk()
53     	for (quirk = quirk_comp->data; quirk->ifnum >= 0; ++quirk) {
54     		iface = usb_ifnum_to_if(chip->dev, quirk->ifnum);
55     		if (!iface)
56     			continue;
57     		if (quirk->ifnum != probed_ifnum &&
58     		    !usb_interface_claimed(iface))
vvv     CID 1475945:  Error handling issues  (CHECKED_RETURN)
vvv     Calling "usb_driver_claim_interface" without checking return value (as is done elsewhere 16 out of 20 times).
59     			usb_driver_claim_interface(driver, iface, (void *)-1L);
60     	}
61
62     	return 0;
63     }
64

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1475943 ("Error handling issues")
Addresses-Coverity-ID: 1475944 ("Error handling issues")
Addresses-Coverity-ID: 1475945 ("Error handling issues")
Fixes: b1ce7ba619d9 ("ALSA: usb-audio: claim autodetected PCM interfaces all at once")
Fixes: e5779998bf8b ("ALSA: usb-audio: refactor code")

Thanks for your attention!

-- 
Coverity-bot

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-05 18:02 Coverity: ALSA: usb-audio: Error handling issues coverity-bot

Linux-Next Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-next/0 linux-next/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-next linux-next/ https://lore.kernel.org/linux-next \
		linux-next@vger.kernel.org
	public-inbox-index linux-next

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-next


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git