Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

af_unix: Replace BUG_ON() with WARN_ON_ONCE().

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 <kuniyu@amazon.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240129190435.57228-2-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Kuniyuki Iwashima and committed by
Jakub Kicinski
d0f6dc26 2dc23b6f

+8 -8
+4 -4
net/unix/garbage.c
··· 145 145 /* An embryo cannot be in-flight, so it's safe 146 146 * to use the list link. 147 147 */ 148 - BUG_ON(!list_empty(&u->link)); 148 + WARN_ON_ONCE(!list_empty(&u->link)); 149 149 list_add_tail(&u->link, &embryos); 150 150 } 151 151 spin_unlock(&x->sk_receive_queue.lock); ··· 213 213 214 214 total_refs = file_count(u->sk.sk_socket->file); 215 215 216 - BUG_ON(!u->inflight); 217 - BUG_ON(total_refs < u->inflight); 216 + WARN_ON_ONCE(!u->inflight); 217 + WARN_ON_ONCE(total_refs < u->inflight); 218 218 if (total_refs == u->inflight) { 219 219 list_move_tail(&u->link, &gc_candidates); 220 220 __set_bit(UNIX_GC_CANDIDATE, &u->gc_flags); ··· 294 294 list_move_tail(&u->link, &gc_inflight_list); 295 295 296 296 /* All candidates should have been detached by now. */ 297 - BUG_ON(!list_empty(&gc_candidates)); 297 + WARN_ON_ONCE(!list_empty(&gc_candidates)); 298 298 299 299 /* Paired with READ_ONCE() in wait_for_unix_gc(). */ 300 300 WRITE_ONCE(gc_in_progress, false);
+4 -4
net/unix/scm.c
··· 51 51 52 52 if (u) { 53 53 if (!u->inflight) { 54 - BUG_ON(!list_empty(&u->link)); 54 + WARN_ON_ONCE(!list_empty(&u->link)); 55 55 list_add_tail(&u->link, &gc_inflight_list); 56 56 } else { 57 - BUG_ON(list_empty(&u->link)); 57 + WARN_ON_ONCE(list_empty(&u->link)); 58 58 } 59 59 u->inflight++; 60 60 /* Paired with READ_ONCE() in wait_for_unix_gc() */ ··· 71 71 spin_lock(&unix_gc_lock); 72 72 73 73 if (u) { 74 - BUG_ON(!u->inflight); 75 - BUG_ON(list_empty(&u->link)); 74 + WARN_ON_ONCE(!u->inflight); 75 + WARN_ON_ONCE(list_empty(&u->link)); 76 76 77 77 u->inflight--; 78 78 if (!u->inflight)