aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBreno Leitao <leitao@debian.org>2024-04-11 12:22:29 -0700
committerJakub Kicinski <kuba@kernel.org>2024-04-15 11:19:52 -0700
commit4854b463c4b27c94a7de86d16ad84f235f4c1a72 (patch)
treed9bd752b0a4f6d488277d1212f31f160ff202555 /include
parent444cde13826bb4d3f9fdf829bf5e2f7bb03d9c32 (diff)
downloadwireless-testing-4854b463c4b27c94a7de86d16ad84f235f4c1a72.tar.gz
net: dql: Avoid calling BUG() when WARN() is enough
If the dql_queued() function receives an invalid argument, WARN about it and continue, instead of crashing the kernel. This was raised by checkpatch, when I am refactoring this code (see following patch/commit) WARNING: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants Signed-off-by: Breno Leitao <leitao@debian.org> Link: https://lore.kernel.org/r/20240411192241.2498631-2-leitao@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/dynamic_queue_limits.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
index 5693a4be0d9a99..ff9c65841ae8d7 100644
--- a/include/linux/dynamic_queue_limits.h
+++ b/include/linux/dynamic_queue_limits.h
@@ -91,7 +91,8 @@ static inline void dql_queued(struct dql *dql, unsigned int count)
{
unsigned long map, now, now_hi, i;
- BUG_ON(count > DQL_MAX_OBJECT);
+ if (WARN_ON_ONCE(count > DQL_MAX_OBJECT))
+ return;
dql->last_obj_cnt = count;