Linux-Next Archive on lore.kernel.org
 help / color / Atom feed
From: coverity-bot <keescook@chromium.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: Daniel Mack <daniel@caiaq.de>,
	Clemens Ladisch <clemens@ladisch.de>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-next@vger.kernel.org
Subject: Coverity: ALSA: usb-audio: Error handling issues
Date: Mon, 5 Apr 2021 11:02:16 -0700
Message-ID: <202104051059.FB7F3016@keescook> (raw)

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

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202104051059.FB7F3016@keescook \
    --to=keescook@chromium.org \
    --cc=clemens@ladisch.de \
    --cc=daniel@caiaq.de \
    --cc=gustavo@embeddedor.com \
    --cc=linux-next@vger.kernel.org \
    --cc=tiwai@suse.de \
    /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

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