From nobody Tue Jan 02 01:12:53 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 4T3vwk06Dyz562nW; Tue, 2 Jan 2024 01:12:54 +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 4T3vwj6F22z3ZhL; Tue, 2 Jan 2024 01:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704157973; 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=QGlTci68IUFW2uq2d+5jyHxeQfwKTbBzjpGcfOby/9A=; b=iSlUYhwQNwUEBxHbhs6uPyjjyXE91dgfUQV2QWDlp86+vGJFioPRRb2KUf2GReVav0pGDl 8Icvh4UVHVD90nDwYMvS6cxY4CSXX4/hiJWR35iueOPc8xIo5IwmOQMQ67NnbuWC4tq5lj rb73fHDpfG8mfvC+p4bCSEh/129+D+aMaWytZ1teKvdJeLc/BprR+0Q/Wt/uNM/pnDiM6c l8aLNGFclqoI63BBE8sXYkl9RgGz24dOYKgDdUnQRQz9u/ed2TZ8xcP4LikT0ErFxhVV7N vIXtEV81xuBZhIVGuak/MeOwMhXpNXeYt2beVddFWAKeXmWCFlBjVOypDWhDZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704157973; a=rsa-sha256; cv=none; b=rwc+CzTBT/DQxKJEnVAhgj6nvgyIqmt2tL4BBOGu9/JxELnh4noXc4yfdcKvb3EjzZHEAx Wm8lfotKxSoOdPJbYgEs8J+NmCY63lMloNPdSDbFhEfINBMqH+TfSX/bv2RMIDFH/yuxFY jFeouXLowOhNJ+JsK3xK344MfEGIja0yIsu7hDpcJbGhcGsMLyPuSeSjac5VOMEoWI74dm Uq1tV7b1loVoiM4OkEerg+49fCb1XfzIdNeUQm3sYzXkTwrK0l87cjyMD6+ZqUz7c6A718 v1Qn5fGzIAGGll8jwgvntBWn29ynnS5Dua79sQ7sgBh/IBcTqwF3AzEpUkxSIA== 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=1704157973; 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=QGlTci68IUFW2uq2d+5jyHxeQfwKTbBzjpGcfOby/9A=; b=qJ0FWY3XoaNTebZEXXnIipzQYR6pqKoqiQXy00wGLqsXOrukVy9gCE+B6K5amyiKOIF1G3 bUx13s+njESqgZJ8pVjIE8or1sLAjxSJT6tBr/2+KpHSOwfVI+MjIp2ubYer31SeWKX4Nu pgSjdYCx5C7jkVPxqi2HKFkM8V0Ym0k/jLb53t7rzfn3EUocfYcQLg+jgWU8ss6s0hmVzB IqoqK0cjb8zW92dDTCVUasahhgxrLWcMk0sm/LAVieF/q1vPTpywhBAxJm/k15wwtEzQMD hVRRJ+0t8N5yGnTSnkmJ9oJ1i8xXpx8+6JOxsGsZLpgu2D1sAHIcaSLH8mUQeQ== 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 4T3vwj5JQbzgRC; Tue, 2 Jan 2024 01:12:53 +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 4021Cr41054512; Tue, 2 Jan 2024 01:12:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4021Cr4b054509; Tue, 2 Jan 2024 01:12:53 GMT (envelope-from git) Date: Tue, 2 Jan 2024 01:12:53 GMT Message-Id: <202401020112.4021Cr4b054509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 163e0066ff1e - stable/13 - ath: Handle errors from copyout() in ath_rate_fetch_node_stats() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 163e0066ff1e28c83a53ad2ab5c2804daa662c1b Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=163e0066ff1e28c83a53ad2ab5c2804daa662c1b commit 163e0066ff1e28c83a53ad2ab5c2804daa662c1b Author: Mark Johnston AuthorDate: 2023-12-26 01:35:43 +0000 Commit: Mark Johnston CommitDate: 2024-01-02 01:12:44 +0000 ath: Handle errors from copyout() in ath_rate_fetch_node_stats() MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43096 (cherry picked from commit 711880597c6c4ac971eb2aba6a2dadb5933d38dd) --- sys/dev/ath/ath_rate/sample/sample.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c index 39ca5d1e9f31..8e70699f708d 100644 --- a/sys/dev/ath/ath_rate/sample/sample.c +++ b/sys/dev/ath/ath_rate/sample/sample.c @@ -1433,11 +1433,13 @@ ath_rate_fetch_node_stats(struct ath_softc *sc, struct ath_node *an, const HAL_RATE_TABLE *rt = sc->sc_currates; struct ath_rateioctl_tlv av; struct ath_rateioctl_rt *tv; - int y; + int error, y; int o = 0; ATH_NODE_LOCK_ASSERT(an); + error = 0; + /* * Ensure there's enough space for the statistics. */ @@ -1478,9 +1480,13 @@ ath_rate_fetch_node_stats(struct ath_softc *sc, struct ath_node *an, */ av.tlv_id = ATH_RATE_TLV_RATETABLE; av.tlv_len = sizeof(struct ath_rateioctl_rt); - copyout(&av, rs->buf + o, sizeof(struct ath_rateioctl_tlv)); + error = copyout(&av, rs->buf + o, sizeof(struct ath_rateioctl_tlv)); + if (error != 0) + goto out; o += sizeof(struct ath_rateioctl_tlv); - copyout(tv, rs->buf + o, sizeof(struct ath_rateioctl_rt)); + error = copyout(tv, rs->buf + o, sizeof(struct ath_rateioctl_rt)); + if (error != 0) + goto out; o += sizeof(struct ath_rateioctl_rt); /* @@ -1488,18 +1494,22 @@ ath_rate_fetch_node_stats(struct ath_softc *sc, struct ath_node *an, */ av.tlv_id = ATH_RATE_TLV_SAMPLENODE; av.tlv_len = sizeof(struct sample_node); - copyout(&av, rs->buf + o, sizeof(struct ath_rateioctl_tlv)); + error = copyout(&av, rs->buf + o, sizeof(struct ath_rateioctl_tlv)); + if (error != 0) + goto out; o += sizeof(struct ath_rateioctl_tlv); /* * Copy the statistics over to the provided buffer. */ - copyout(sn, rs->buf + o, sizeof(struct sample_node)); + error = copyout(sn, rs->buf + o, sizeof(struct sample_node)); + if (error != 0) + goto out; o += sizeof(struct sample_node); +out: free(tv, M_TEMP); - - return (0); + return (error); } static void