From nobody Wed Dec 17 03:27:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B71A31D63DF; Wed, 21 May 2025 14:49:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747838996; cv=none; b=CM7UgrpRrJ1q1AV7jiD/IL5C1Rpi6+8hPISsZ1QuESdUnx8TdYqa5VJ3HQeUe80eD8yacqCzK0mMd9+pbQRY9SrSRl8YAi2ywndnoeefd2ft/d5j8jdPu+HbulLm4uFt8yWnHEZXdAscPOjNs9OraKsi+a4gO1YHDWX/O7yJg6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747838996; c=relaxed/simple; bh=rUbsdizpyy0BfPaaxnOjmiPENgTIRCEFrJ0owHP8VDY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PBIe59bkmj3p6Kcx4ZUSJUWoQ0tWtZ4WgbSSimJFyJu1Blm+JOdeCJ1/riLA0ioT60LXyeOxa7iW4vOgj1LTQbbNHFmituEVAzFZMh5DPFG9QnfE7hBx8eExIBznxjO/qXoytsqc9wVKm1LNnCsKo88+oxwTpkwFOmDqKICxMq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E5XnY31j; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E5XnY31j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2A5DC4CEE4; Wed, 21 May 2025 14:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747838996; bh=rUbsdizpyy0BfPaaxnOjmiPENgTIRCEFrJ0owHP8VDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E5XnY31jYeaRpcMNMsks6CZkqLulVxE1twVgsZvIeh6eH1DENlQ/GSKUKy5/zIdFS yWSK6hh7fm1Q+qRYh1hx+Wfzm9jH1JmE0SYIw5bvs9x6zrB3azrtwIbnE69aAB+lHS Z2OsOWgfzHSbQY0/DnsrIe9jCg8fSDKVWeJqD2Q3CXatAYjwVbaZubGS+4hnxvJvmV eZY0HVk0gspYhk7/oZsrZ78iNUjt8Zua6wKTdG3HVP5BXT/dlTfOkKK/f6dpe8tXkg EJ8hVGW5hAp8rU2qQ3JquaqbFouWWQughVq4zm7sv5dWqzaUND88B5tcVFvA6Y5i5c f6BcTxe+c3A5w== From: Lee Jones To: lee@kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kuniyuki Iwashima , Jens Axboe , Sasha Levin , Michal Luczaj , Rao Shoaib , Simon Horman , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: stable@vger.kernel.org Subject: [PATCH v6.6 04/26] af_unix: Replace BUG_ON() with WARN_ON_ONCE(). Date: Wed, 21 May 2025 14:45:12 +0000 Message-ID: <20250521144803.2050504-5-lee@kernel.org> X-Mailer: git-send-email 2.49.0.1112.g889b7c5bd8-goog In-Reply-To: <20250521144803.2050504-1-lee@kernel.org> References: <20250521144803.2050504-1-lee@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit d0f6dc26346863e1f4a23117f5468614e54df064 ] This is a prep patch for the last patch in this series so that checkpatch will not warn about BUG_ON(). Signed-off-by: Kuniyuki Iwashima Acked-by: Jens Axboe Link: https://lore.kernel.org/r/20240129190435.57228-2-kuniyu@amazon.com Signed-off-by: Jakub Kicinski (cherry picked from commit d0f6dc26346863e1f4a23117f5468614e54df064) Signed-off-by: Lee Jones --- net/unix/garbage.c | 8 ++++---- net/unix/scm.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 96cc6b7674333..b4bf7f7538826 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -145,7 +145,7 @@ static void scan_children(struct sock *x, void (*func)(= struct unix_sock *), /* An embryo cannot be in-flight, so it's safe * to use the list link. */ - BUG_ON(!list_empty(&u->link)); + WARN_ON_ONCE(!list_empty(&u->link)); list_add_tail(&u->link, &embryos); } spin_unlock(&x->sk_receive_queue.lock); @@ -224,8 +224,8 @@ static void __unix_gc(struct work_struct *work) =20 total_refs =3D file_count(sk->sk_socket->file); =20 - BUG_ON(!u->inflight); - BUG_ON(total_refs < u->inflight); + WARN_ON_ONCE(!u->inflight); + WARN_ON_ONCE(total_refs < u->inflight); if (total_refs =3D=3D u->inflight) { list_move_tail(&u->link, &gc_candidates); __set_bit(UNIX_GC_CANDIDATE, &u->gc_flags); @@ -318,7 +318,7 @@ static void __unix_gc(struct work_struct *work) list_move_tail(&u->link, &gc_inflight_list); =20 /* All candidates should have been detached by now. */ - BUG_ON(!list_empty(&gc_candidates)); + WARN_ON_ONCE(!list_empty(&gc_candidates)); =20 /* Paired with READ_ONCE() in wait_for_unix_gc(). */ WRITE_ONCE(gc_in_progress, false); diff --git a/net/unix/scm.c b/net/unix/scm.c index b5ae5ab167773..505e56cf02a21 100644 --- a/net/unix/scm.c +++ b/net/unix/scm.c @@ -51,10 +51,10 @@ void unix_inflight(struct user_struct *user, struct fil= e *fp) =20 if (u) { if (!u->inflight) { - BUG_ON(!list_empty(&u->link)); + WARN_ON_ONCE(!list_empty(&u->link)); list_add_tail(&u->link, &gc_inflight_list); } else { - BUG_ON(list_empty(&u->link)); + WARN_ON_ONCE(list_empty(&u->link)); } u->inflight++; /* Paired with READ_ONCE() in wait_for_unix_gc() */ @@ -71,8 +71,8 @@ void unix_notinflight(struct user_struct *user, struct fi= le *fp) spin_lock(&unix_gc_lock); =20 if (u) { - BUG_ON(!u->inflight); - BUG_ON(list_empty(&u->link)); + WARN_ON_ONCE(!u->inflight); + WARN_ON_ONCE(list_empty(&u->link)); =20 u->inflight--; if (!u->inflight) --=20 2.49.0.1112.g889b7c5bd8-goog