From nobody Tue Nov 09 21:13:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2A3BF184CAC0; Tue, 9 Nov 2021 21:13:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HpggJ5clfz4d2y; Tue, 9 Nov 2021 21:13:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FAD940D4; Tue, 9 Nov 2021 21:13:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A9LD0jJ054237; Tue, 9 Nov 2021 21:13:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A9LD0jF054236; Tue, 9 Nov 2021 21:13:00 GMT (envelope-from git) Date: Tue, 9 Nov 2021 21:13:00 GMT Message-Id: <202111092113.1A9LD0jF054236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 11f09b17fe2c - main - snd_uaudio(4): Fix string index computations for iFeature. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11f09b17fe2cf0b5489601aee548a06486f0b749 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=11f09b17fe2cf0b5489601aee548a06486f0b749 commit 11f09b17fe2cf0b5489601aee548a06486f0b749 Author: Hans Petter Selasky AuthorDate: 2021-11-09 21:07:36 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-09 21:11:25 +0000 snd_uaudio(4): Fix string index computations for iFeature. This allows the iFeature strings to be properly read by the snd_uaudio(4) driver, when parsing the audio feature unit descriptors. Submitted by: Zhichao1.Li@dell.com MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/sound/usb/uaudio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 3a7d4189b9ef..bc5b0d04c020 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -3648,18 +3648,18 @@ uaudio_mixer_add_feature(struct uaudio_softc *sc, cmask |= uaudio_mixer_feature_get_bmaControls(d, chan); } - if (nchan > MIX_MAX_CHAN) - nchan = MIX_MAX_CHAN; - MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); - i = d->bmaControls[d->bControlSize]; + i = d->bmaControls[nchan * d->bControlSize]; if (i == 0 || usbd_req_get_string_any(sc->sc_udev, NULL, MIX(sc).desc, sizeof(MIX(sc).desc), i) != 0) { MIX(sc).desc[0] = 0; } + if (nchan > MIX_MAX_CHAN) + nchan = MIX_MAX_CHAN; + for (ctl = 1; ctl <= LOUDNESS_CONTROL; ctl++) { fumask = FU_MASK(ctl); @@ -3782,9 +3782,6 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc, for (chan = 1; chan < nchan; chan++) cmask |= UGETDW(d->bmaControls[chan]); - if (nchan > MIX_MAX_CHAN) - nchan = MIX_MAX_CHAN; - MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); i = d->bmaControls[nchan][0]; @@ -3794,6 +3791,9 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc, MIX(sc).desc[0] = 0; } + if (nchan > MIX_MAX_CHAN) + nchan = MIX_MAX_CHAN; + for (ctl = 3; ctl != 0; ctl <<= 2) { mixernumber = uaudio20_mixer_determine_class(&iot[id]);