net: dql: Avoid calling BUG() when WARN() is enough
BugLink: https://bugs.launchpad.net/bugs/2077600 [ Upstream commit 4854b463c4b27c94a7de86d16ad84f235f4c1a72 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Portia Stephens <portia.stephens@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
This commit is contained in:
committed by
Stefan Bader
parent
875ddd3247
commit
a420e73c8c
@@ -74,7 +74,8 @@ struct dql {
|
||||
*/
|
||||
static inline void dql_queued(struct dql *dql, unsigned int count)
|
||||
{
|
||||
BUG_ON(count > DQL_MAX_OBJECT);
|
||||
if (WARN_ON_ONCE(count > DQL_MAX_OBJECT))
|
||||
return;
|
||||
|
||||
dql->last_obj_cnt = count;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user