From nobody Tue May 21 17:53:55 2024 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 4VkMW75PyHz5LtpX; Tue, 21 May 2024 17:53:55 +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 4VkMW74lCdz4rBX; Tue, 21 May 2024 17:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716314035; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2Dv8lWNAK85oNlprZwpGG8BCLI1rrJK3rTAo9D6TDJM=; b=QsR1pRqF66vWSH+1xRAFbXmmZ27avLMeCanWf1e69wuVlGGGznDsB3ENI4Po+1nAOJYwRe 2vAEJs/zsZz5nsovH+7SOqpHh26GWzPajwF+lkIPZZT3RchpW8F/qyvhKewJqd8FFTjzyh 9w+Ko8zYlqYgm6C0Q3co1Wpj+/wYRkFY0Y+eXQ5XZM0zlJ8ipmFJZfCt14Xn6vpkgOL462 sIhBYMqngLa7erV4HlcKvRpiM0tR3A84QhpSCOKqm2lMNtMkcM+MC2pEEfAyVcd6ea+cAy EkMH5vDUS5ITe4yNrMlNpXnF7Hk5eC4ZrKECrJWQ+acRO1OkitqFcRekvT9Q3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716314035; a=rsa-sha256; cv=none; b=tyzR8cLtZNP0a+r/77TCWBVyxSvJOmDkoLLuvnX8QyLDWmNpxD5rmh+aocI8E1kkL2EZJl fEegfqv2AnP7tcoJUW9s4SjQtknNco3UCp7LWdmJxYMm/NhFdxip++Ll7CcFMaFzgKwzG5 zONoBjEOne/a9Rn8fqbCxmnLRWgA0ccpuipZsA5u89hzaa6bZa6DGKN4oMm1TPpObR5Crs WS6+9SDUUMm+xIWWuX1BINl+EkByK/rjCyye+j+FzFW7oSrfguJyFGLYsH32WHKvrh8Wbh yOf/WsK27ngNutnmkDi+K+wFRI1rOQt1Yg4ugTMiMOi+EtSKshPneb5MSH32lA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716314035; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2Dv8lWNAK85oNlprZwpGG8BCLI1rrJK3rTAo9D6TDJM=; b=xFq5aREioxVKHrBB9D0+FVDyguw7zHV2d6uqAenUEKMVY3TZU6PICVJpQrU+TqZ2hPhqv8 wBMaPJ+z+Wh6BYfzoSZ5DqJ0IUUQfnjRAKfwhe18zPfQB2+P+QJGB7g9w3SAsNzsNX3RsQ mDKB7uEJcLfSH6Je5Ffx7zpaqrtZkZQyaMPHLl6gemfwvIHzf635PfIHBmncxBmQzn9qzH G3XMHs/dONPo9PdAFGsFZlOHLJaJnU5fiX0PEo9BrNofKlAkFFq6ttWdfvgmZ8X2vMnQQb UIxtfRCtr9YirmcbTq4Mlk6pYKPOaxHQANGk1bwpyfB0tmk1wfQr+7Kxv9qS5g== 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 4VkMW74Lg5zWmr; Tue, 21 May 2024 17:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44LHrtud021661; Tue, 21 May 2024 17:53:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44LHrtlf021658; Tue, 21 May 2024 17:53:55 GMT (envelope-from git) Date: Tue, 21 May 2024 17:53:55 GMT Message-Id: <202405211753.44LHrtlf021658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: bca6f391aed9 - stable/14 - sound: Prevent uninitialized variable destruction in chn_init() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bca6f391aed9ecc01d6b7f496ddb6a17311e4c2c Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=bca6f391aed9ecc01d6b7f496ddb6a17311e4c2c commit bca6f391aed9ecc01d6b7f496ddb6a17311e4c2c Author: Christos Margiolis AuthorDate: 2024-05-20 14:14:25 +0000 Commit: Christos Margiolis CommitDate: 2024-05-21 17:45:41 +0000 sound: Prevent uninitialized variable destruction in chn_init() If dsp_unit2name() fails, we'll get to out2 with b, bs and devinfo uninitialized, which will result in a panic. Reported by: Pierre Pronchery Reported by: Coverity Scan CID: 1545029, 1545025 Pull-request: https://github.com/freebsd/freebsd-src/pull/1240 Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45272 (cherry picked from commit 5d1a5d6f1f599a4fbea9634cbe5c77f7370e1a5d) --- sys/dev/sound/pcm/channel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 039d9abb9da2..a18ef1cf4234 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1236,6 +1236,8 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, } PCM_UNLOCK(d); + b = NULL; + bs = NULL; c = malloc(sizeof(*c), M_DEVBUF, M_WAITOK | M_ZERO); c->methods = kobj_create(cls, M_DEVBUF, M_WAITOK | M_ZERO); c->type = type; @@ -1257,8 +1259,6 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, snprintf(c->name, sizeof(c->name), "%s:%s:%s", device_get_nameunit(c->dev), dirs, devname); - b = NULL; - bs = NULL; CHN_INIT(c, children); CHN_INIT(c, children.busy); c->latency = -1;