From nobody Mon May 20 14:14:44 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 4Vjfhh2lD9z5LLd5; Mon, 20 May 2024 14:14:44 +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 4Vjfhh1yWJz4Vp3; Mon, 20 May 2024 14:14:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716214484; 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=Ltk0v2XuRTJn3PFr/ittL8wlvfFExaLq0lGiS2EQ/0Y=; b=mUhYjz1PIYLXiJbA9YUbYEzoz53GmidlJMoi5rus2dDRyVOlliRDwP/24AunshH+VTLQqc IYnejZhJioZE4A3m2YnUAN/3xUS0BI4Ec1pdmPUkQAvAOU61QFmh6HbhnKGH8dzqV1iVz3 xeIHtPR2Yeedw1RL2PQuEpc+tqKQFdFhx2EiPeAy7CV96WG4Zb3M9dVqHuxP0LN8AlxcDZ NsCwhCxYYt+zdzlD7PhzLUd4PRiHpBzYE+pHUg/FxZcv9zQa8GMsp114NBvDCR4PdQk9L9 6pyOTC4J5TPtDJWKz+/isHlZ2c9zPApI9ez9LcECBHhDp7P1C1A2FSzS3v6zvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716214484; a=rsa-sha256; cv=none; b=ej+05j0sdvj7j2AB6iJJUemju9FhSO+Y46HZXUwwEmk4e7bhe9uJLQhd0b4Kr+0P0BdwbR ZmMUEP39xADiJVLrZyVROcLS5Z8AQZWan1M3mNIHbu8qkP91ElVx5u1v4Zv16MW6raMLFN C1OzKy0sCdvNh4Mi7MOvNWLw89uHbVI4NI8TI8v+YT3pTOB/fvTJRorpjqbfgB4TO3Eg6U /JmWanCm/swr1T5vbmmHtFZOoLDogKeYyjs8HdCS+tKOAmqqTSns6DMCnx4BeJ5BYJgzKx ZGH6X0R63GwHBJ68vro0nFbZtKIrZ28UhZp7O47f2ZIew7ant6zeYk4hzLMtxw== 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=1716214484; 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=Ltk0v2XuRTJn3PFr/ittL8wlvfFExaLq0lGiS2EQ/0Y=; b=lg3CJDmFc6hZHKA5/NnYbP2bo1DNiQwN8ds84xS5M6yjJmP/GYYBD5eiDmY9sxC3YpNSv4 DC8rPshnJRSWrBh1DIplclSdANqpD0M5e9yxi69TgxeQ3OTkOoaOi+yhNAKhViOkxjhtiK hajsEYuMpj0LrZMvF1bXdTVJD7D35ujWtJYc5Vc0hVKzJcE13QcC86tN+ZQOOW+GahLOPZ cBo3/ZkLRGj89Ti1d0lfJmaaznEZbOUsEZiDsCrsUhHc5To33znCDWgM07XPOVyzETd/0h eKn+BdefcjNGcig4z5zkuEaCiONpqxwKXYLSxuYOPgaPP9iblt9I8iYEzfrf/g== 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 4Vjfhh1Yx8zhYd; Mon, 20 May 2024 14:14:44 +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 44KEEiGt014332; Mon, 20 May 2024 14:14:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44KEEiQm014329; Mon, 20 May 2024 14:14:44 GMT (envelope-from git) Date: Mon, 20 May 2024 14:14:44 GMT Message-Id: <202405201414.44KEEiQm014329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 5d1a5d6f1f59 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 5d1a5d6f1f599a4fbea9634cbe5c77f7370e1a5d Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=5d1a5d6f1f599a4fbea9634cbe5c77f7370e1a5d commit 5d1a5d6f1f599a4fbea9634cbe5c77f7370e1a5d Author: Christos Margiolis AuthorDate: 2024-05-20 14:14:25 +0000 Commit: Christos Margiolis CommitDate: 2024-05-20 14:14:25 +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 --- 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;