]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: vlan: Replace BUG() with WARN_ON_ONCE() in vlan_dev_* stubs
authorGal Pressman <gal@nvidia.com>
Mon, 16 Jun 2025 13:26:25 +0000 (16:26 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 18 Jun 2025 01:06:38 +0000 (18:06 -0700)
When CONFIG_VLAN_8021Q=n, a set of stub helpers are used, three of these
helpers use BUG() unconditionally.

This code should not be reached, as callers of these functions should
always check for is_vlan_dev() first, but the usage of BUG() is not
recommended, replace it with WARN_ON() instead.

Reviewed-by: Alex Lazar <alazar@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
Link: https://patch.msgid.link/20250616132626.1749331-3-gal@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/if_vlan.h

index 618a973ff8ee1f1e6b8b28d50be3a662ef2ddc7d..b9f699799cf6e9a5b3469e225167269a001555a0 100644 (file)
@@ -259,19 +259,19 @@ vlan_for_each(struct net_device *dev,
 
 static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
 {
-       BUG();
+       WARN_ON_ONCE(1);
        return NULL;
 }
 
 static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
 {
-       BUG();
+       WARN_ON_ONCE(1);
        return 0;
 }
 
 static inline __be16 vlan_dev_vlan_proto(const struct net_device *dev)
 {
-       BUG();
+       WARN_ON_ONCE(1);
        return 0;
 }