* [PATCH net-next 0/4] net: CONFIG_DEBUG_NET and friends
@ 2022-05-09 19:08 Eric Dumazet
2022-05-09 19:08 ` [PATCH net-next 1/4] net: add include/net/net_debug.h Eric Dumazet
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Eric Dumazet @ 2022-05-09 19:08 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: netdev, Eric Dumazet, Eric Dumazet
From: Eric Dumazet <edumazet@google.com>
This patch series is inspired by some syzbot reports
hinting that skb transport_header might be not set
in places we expect it being set.
Add a new CONFIG_DEBUG_NET option
and DEBUG_NET_WARN_ON_ONCE() helper, so that we can start
adding more sanity checks in the future.
Replace two BUG() in skb_checksum_help()
with less risky code.
Eric Dumazet (4):
net: add include/net/net_debug.h
net: add CONFIG_DEBUG_NET
net: warn if transport header was not set
net: remove two BUG() from skb_checksum_help()
include/linux/netdevice.h | 154 +----------------------------------
include/linux/skbuff.h | 2 +
include/net/net_debug.h | 165 ++++++++++++++++++++++++++++++++++++++
net/Kconfig.debug | 7 ++
net/core/dev.c | 8 +-
5 files changed, 181 insertions(+), 155 deletions(-)
create mode 100644 include/net/net_debug.h
--
2.36.0.512.ge40c2bad7a-goog
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH net-next 1/4] net: add include/net/net_debug.h 2022-05-09 19:08 [PATCH net-next 0/4] net: CONFIG_DEBUG_NET and friends Eric Dumazet @ 2022-05-09 19:08 ` Eric Dumazet 2022-05-09 19:08 ` [PATCH net-next 2/4] net: add CONFIG_DEBUG_NET Eric Dumazet ` (2 subsequent siblings) 3 siblings, 0 replies; 12+ messages in thread From: Eric Dumazet @ 2022-05-09 19:08 UTC (permalink / raw) To: David S . Miller, Jakub Kicinski, Paolo Abeni Cc: netdev, Eric Dumazet, Eric Dumazet From: Eric Dumazet <edumazet@google.com> Remove from include/linux/netdevice.h helpers that send debug/info/warnings to syslog. We plan adding more helpers in following patches. Signed-off-by: Eric Dumazet <edumazet@google.com> --- include/linux/netdevice.h | 154 +----------------------------------- include/net/net_debug.h | 159 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 153 deletions(-) create mode 100644 include/net/net_debug.h diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 74c97a34921d48c593c08e2bed72e099f42520a3..88ee2bcf35cf5f48fa41dc98e840802fbd81b36a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -50,6 +50,7 @@ #include <linux/hashtable.h> #include <linux/rbtree.h> #include <net/net_trackers.h> +#include <net/net_debug.h> struct netpoll_info; struct device; @@ -5050,162 +5051,9 @@ static inline const char *netdev_reg_state(const struct net_device *dev) return " (unknown)"; } -__printf(3, 4) __cold -void netdev_printk(const char *level, const struct net_device *dev, - const char *format, ...); -__printf(2, 3) __cold -void netdev_emerg(const struct net_device *dev, const char *format, ...); -__printf(2, 3) __cold -void netdev_alert(const struct net_device *dev, const char *format, ...); -__printf(2, 3) __cold -void netdev_crit(const struct net_device *dev, const char *format, ...); -__printf(2, 3) __cold -void netdev_err(const struct net_device *dev, const char *format, ...); -__printf(2, 3) __cold -void netdev_warn(const struct net_device *dev, const char *format, ...); -__printf(2, 3) __cold -void netdev_notice(const struct net_device *dev, const char *format, ...); -__printf(2, 3) __cold -void netdev_info(const struct net_device *dev, const char *format, ...); - -#define netdev_level_once(level, dev, fmt, ...) \ -do { \ - static bool __section(".data.once") __print_once; \ - \ - if (!__print_once) { \ - __print_once = true; \ - netdev_printk(level, dev, fmt, ##__VA_ARGS__); \ - } \ -} while (0) - -#define netdev_emerg_once(dev, fmt, ...) \ - netdev_level_once(KERN_EMERG, dev, fmt, ##__VA_ARGS__) -#define netdev_alert_once(dev, fmt, ...) \ - netdev_level_once(KERN_ALERT, dev, fmt, ##__VA_ARGS__) -#define netdev_crit_once(dev, fmt, ...) \ - netdev_level_once(KERN_CRIT, dev, fmt, ##__VA_ARGS__) -#define netdev_err_once(dev, fmt, ...) \ - netdev_level_once(KERN_ERR, dev, fmt, ##__VA_ARGS__) -#define netdev_warn_once(dev, fmt, ...) \ - netdev_level_once(KERN_WARNING, dev, fmt, ##__VA_ARGS__) -#define netdev_notice_once(dev, fmt, ...) \ - netdev_level_once(KERN_NOTICE, dev, fmt, ##__VA_ARGS__) -#define netdev_info_once(dev, fmt, ...) \ - netdev_level_once(KERN_INFO, dev, fmt, ##__VA_ARGS__) - #define MODULE_ALIAS_NETDEV(device) \ MODULE_ALIAS("netdev-" device) -#if defined(CONFIG_DYNAMIC_DEBUG) || \ - (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE)) -#define netdev_dbg(__dev, format, args...) \ -do { \ - dynamic_netdev_dbg(__dev, format, ##args); \ -} while (0) -#elif defined(DEBUG) -#define netdev_dbg(__dev, format, args...) \ - netdev_printk(KERN_DEBUG, __dev, format, ##args) -#else -#define netdev_dbg(__dev, format, args...) \ -({ \ - if (0) \ - netdev_printk(KERN_DEBUG, __dev, format, ##args); \ -}) -#endif - -#if defined(VERBOSE_DEBUG) -#define netdev_vdbg netdev_dbg -#else - -#define netdev_vdbg(dev, format, args...) \ -({ \ - if (0) \ - netdev_printk(KERN_DEBUG, dev, format, ##args); \ - 0; \ -}) -#endif - -/* - * netdev_WARN() acts like dev_printk(), but with the key difference - * of using a WARN/WARN_ON to get the message out, including the - * file/line information and a backtrace. - */ -#define netdev_WARN(dev, format, args...) \ - WARN(1, "netdevice: %s%s: " format, netdev_name(dev), \ - netdev_reg_state(dev), ##args) - -#define netdev_WARN_ONCE(dev, format, args...) \ - WARN_ONCE(1, "netdevice: %s%s: " format, netdev_name(dev), \ - netdev_reg_state(dev), ##args) - -/* netif printk helpers, similar to netdev_printk */ - -#define netif_printk(priv, type, level, dev, fmt, args...) \ -do { \ - if (netif_msg_##type(priv)) \ - netdev_printk(level, (dev), fmt, ##args); \ -} while (0) - -#define netif_level(level, priv, type, dev, fmt, args...) \ -do { \ - if (netif_msg_##type(priv)) \ - netdev_##level(dev, fmt, ##args); \ -} while (0) - -#define netif_emerg(priv, type, dev, fmt, args...) \ - netif_level(emerg, priv, type, dev, fmt, ##args) -#define netif_alert(priv, type, dev, fmt, args...) \ - netif_level(alert, priv, type, dev, fmt, ##args) -#define netif_crit(priv, type, dev, fmt, args...) \ - netif_level(crit, priv, type, dev, fmt, ##args) -#define netif_err(priv, type, dev, fmt, args...) \ - netif_level(err, priv, type, dev, fmt, ##args) -#define netif_warn(priv, type, dev, fmt, args...) \ - netif_level(warn, priv, type, dev, fmt, ##args) -#define netif_notice(priv, type, dev, fmt, args...) \ - netif_level(notice, priv, type, dev, fmt, ##args) -#define netif_info(priv, type, dev, fmt, args...) \ - netif_level(info, priv, type, dev, fmt, ##args) - -#if defined(CONFIG_DYNAMIC_DEBUG) || \ - (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE)) -#define netif_dbg(priv, type, netdev, format, args...) \ -do { \ - if (netif_msg_##type(priv)) \ - dynamic_netdev_dbg(netdev, format, ##args); \ -} while (0) -#elif defined(DEBUG) -#define netif_dbg(priv, type, dev, format, args...) \ - netif_printk(priv, type, KERN_DEBUG, dev, format, ##args) -#else -#define netif_dbg(priv, type, dev, format, args...) \ -({ \ - if (0) \ - netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ - 0; \ -}) -#endif - -/* if @cond then downgrade to debug, else print at @level */ -#define netif_cond_dbg(priv, type, netdev, cond, level, fmt, args...) \ - do { \ - if (cond) \ - netif_dbg(priv, type, netdev, fmt, ##args); \ - else \ - netif_ ## level(priv, type, netdev, fmt, ##args); \ - } while (0) - -#if defined(VERBOSE_DEBUG) -#define netif_vdbg netif_dbg -#else -#define netif_vdbg(priv, type, dev, format, args...) \ -({ \ - if (0) \ - netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ - 0; \ -}) -#endif - /* * The list of packet types we will receive (as opposed to discard) * and the routines to invoke. diff --git a/include/net/net_debug.h b/include/net/net_debug.h new file mode 100644 index 0000000000000000000000000000000000000000..d8769ee7bced92decf126fe6c521db75e458565c --- /dev/null +++ b/include/net/net_debug.h @@ -0,0 +1,159 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_NET_DEBUG_H +#define _LINUX_NET_DEBUG_H + +__printf(3, 4) __cold +void netdev_printk(const char *level, const struct net_device *dev, + const char *format, ...); +__printf(2, 3) __cold +void netdev_emerg(const struct net_device *dev, const char *format, ...); +__printf(2, 3) __cold +void netdev_alert(const struct net_device *dev, const char *format, ...); +__printf(2, 3) __cold +void netdev_crit(const struct net_device *dev, const char *format, ...); +__printf(2, 3) __cold +void netdev_err(const struct net_device *dev, const char *format, ...); +__printf(2, 3) __cold +void netdev_warn(const struct net_device *dev, const char *format, ...); +__printf(2, 3) __cold +void netdev_notice(const struct net_device *dev, const char *format, ...); +__printf(2, 3) __cold +void netdev_info(const struct net_device *dev, const char *format, ...); + +#define netdev_level_once(level, dev, fmt, ...) \ +do { \ + static bool __section(".data.once") __print_once; \ + \ + if (!__print_once) { \ + __print_once = true; \ + netdev_printk(level, dev, fmt, ##__VA_ARGS__); \ + } \ +} while (0) + +#define netdev_emerg_once(dev, fmt, ...) \ + netdev_level_once(KERN_EMERG, dev, fmt, ##__VA_ARGS__) +#define netdev_alert_once(dev, fmt, ...) \ + netdev_level_once(KERN_ALERT, dev, fmt, ##__VA_ARGS__) +#define netdev_crit_once(dev, fmt, ...) \ + netdev_level_once(KERN_CRIT, dev, fmt, ##__VA_ARGS__) +#define netdev_err_once(dev, fmt, ...) \ + netdev_level_once(KERN_ERR, dev, fmt, ##__VA_ARGS__) +#define netdev_warn_once(dev, fmt, ...) \ + netdev_level_once(KERN_WARNING, dev, fmt, ##__VA_ARGS__) +#define netdev_notice_once(dev, fmt, ...) \ + netdev_level_once(KERN_NOTICE, dev, fmt, ##__VA_ARGS__) +#define netdev_info_once(dev, fmt, ...) \ + netdev_level_once(KERN_INFO, dev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE)) +#define netdev_dbg(__dev, format, args...) \ +do { \ + dynamic_netdev_dbg(__dev, format, ##args); \ +} while (0) +#elif defined(DEBUG) +#define netdev_dbg(__dev, format, args...) \ + netdev_printk(KERN_DEBUG, __dev, format, ##args) +#else +#define netdev_dbg(__dev, format, args...) \ +({ \ + if (0) \ + netdev_printk(KERN_DEBUG, __dev, format, ##args); \ +}) +#endif + +#if defined(VERBOSE_DEBUG) +#define netdev_vdbg netdev_dbg +#else + +#define netdev_vdbg(dev, format, args...) \ +({ \ + if (0) \ + netdev_printk(KERN_DEBUG, dev, format, ##args); \ + 0; \ +}) +#endif + +/* + * netdev_WARN() acts like dev_printk(), but with the key difference + * of using a WARN/WARN_ON to get the message out, including the + * file/line information and a backtrace. + */ +#define netdev_WARN(dev, format, args...) \ + WARN(1, "netdevice: %s%s: " format, netdev_name(dev), \ + netdev_reg_state(dev), ##args) + +#define netdev_WARN_ONCE(dev, format, args...) \ + WARN_ONCE(1, "netdevice: %s%s: " format, netdev_name(dev), \ + netdev_reg_state(dev), ##args) + +/* netif printk helpers, similar to netdev_printk */ + +#define netif_printk(priv, type, level, dev, fmt, args...) \ +do { \ + if (netif_msg_##type(priv)) \ + netdev_printk(level, (dev), fmt, ##args); \ +} while (0) + +#define netif_level(level, priv, type, dev, fmt, args...) \ +do { \ + if (netif_msg_##type(priv)) \ + netdev_##level(dev, fmt, ##args); \ +} while (0) + +#define netif_emerg(priv, type, dev, fmt, args...) \ + netif_level(emerg, priv, type, dev, fmt, ##args) +#define netif_alert(priv, type, dev, fmt, args...) \ + netif_level(alert, priv, type, dev, fmt, ##args) +#define netif_crit(priv, type, dev, fmt, args...) \ + netif_level(crit, priv, type, dev, fmt, ##args) +#define netif_err(priv, type, dev, fmt, args...) \ + netif_level(err, priv, type, dev, fmt, ##args) +#define netif_warn(priv, type, dev, fmt, args...) \ + netif_level(warn, priv, type, dev, fmt, ##args) +#define netif_notice(priv, type, dev, fmt, args...) \ + netif_level(notice, priv, type, dev, fmt, ##args) +#define netif_info(priv, type, dev, fmt, args...) \ + netif_level(info, priv, type, dev, fmt, ##args) + +#if defined(CONFIG_DYNAMIC_DEBUG) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE)) +#define netif_dbg(priv, type, netdev, format, args...) \ +do { \ + if (netif_msg_##type(priv)) \ + dynamic_netdev_dbg(netdev, format, ##args); \ +} while (0) +#elif defined(DEBUG) +#define netif_dbg(priv, type, dev, format, args...) \ + netif_printk(priv, type, KERN_DEBUG, dev, format, ##args) +#else +#define netif_dbg(priv, type, dev, format, args...) \ +({ \ + if (0) \ + netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ + 0; \ +}) +#endif + +/* if @cond then downgrade to debug, else print at @level */ +#define netif_cond_dbg(priv, type, netdev, cond, level, fmt, args...) \ + do { \ + if (cond) \ + netif_dbg(priv, type, netdev, fmt, ##args); \ + else \ + netif_ ## level(priv, type, netdev, fmt, ##args); \ + } while (0) + +#if defined(VERBOSE_DEBUG) +#define netif_vdbg netif_dbg +#else +#define netif_vdbg(priv, type, dev, format, args...) \ +({ \ + if (0) \ + netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ + 0; \ +}) +#endif + + +#endif /* _LINUX_NET_DEBUG_H */ -- 2.36.0.512.ge40c2bad7a-goog ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 2/4] net: add CONFIG_DEBUG_NET 2022-05-09 19:08 [PATCH net-next 0/4] net: CONFIG_DEBUG_NET and friends Eric Dumazet 2022-05-09 19:08 ` [PATCH net-next 1/4] net: add include/net/net_debug.h Eric Dumazet @ 2022-05-09 19:08 ` Eric Dumazet 2022-05-09 19:08 ` [PATCH net-next 3/4] net: warn if transport header was not set Eric Dumazet 2022-05-09 19:08 ` [PATCH net-next 4/4] net: remove two BUG() from skb_checksum_help() Eric Dumazet 3 siblings, 0 replies; 12+ messages in thread From: Eric Dumazet @ 2022-05-09 19:08 UTC (permalink / raw) To: David S . Miller, Jakub Kicinski, Paolo Abeni Cc: netdev, Eric Dumazet, Eric Dumazet From: Eric Dumazet <edumazet@google.com> This config option enables network debugging checks. This patch adds DEBUG_NET_WARN_ON_ONCE(cond) Note that this is not a replacement for WARN_ON_ONCE(cond) as (cond) is not evaluated if CONFIG_DEBUG_NET is not set. Signed-off-by: Eric Dumazet <edumazet@google.com> --- include/net/net_debug.h | 6 ++++++ net/Kconfig.debug | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/include/net/net_debug.h b/include/net/net_debug.h index d8769ee7bced92decf126fe6c521db75e458565c..f972ed3766a157f3f4de958fb6d4789dffc2923c 100644 --- a/include/net/net_debug.h +++ b/include/net/net_debug.h @@ -156,4 +156,10 @@ do { \ #endif +#if defined(CONFIG_DEBUG_NET) +#define DEBUG_NET_WARN_ON_ONCE(cond) (void)WARN_ON_ONCE(cond) +#else +#define DEBUG_NET_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) +#endif + #endif /* _LINUX_NET_DEBUG_H */ diff --git a/net/Kconfig.debug b/net/Kconfig.debug index 2f50611df858911cf5190a361e4e9316e543ed3a..a5781cf63b16b32e5360df1ca26a753b6505d81f 100644 --- a/net/Kconfig.debug +++ b/net/Kconfig.debug @@ -17,3 +17,10 @@ config NET_NS_REFCNT_TRACKER help Enable debugging feature to track netns references. This adds memory and cpu costs. + +config DEBUG_NET + bool "Add generic networking debug" + depends on DEBUG_KERNEL + help + Enable extra sanity checks in networking. + This is mostly used by fuzzers, but is safe to select. -- 2.36.0.512.ge40c2bad7a-goog ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 3/4] net: warn if transport header was not set 2022-05-09 19:08 [PATCH net-next 0/4] net: CONFIG_DEBUG_NET and friends Eric Dumazet 2022-05-09 19:08 ` [PATCH net-next 1/4] net: add include/net/net_debug.h Eric Dumazet 2022-05-09 19:08 ` [PATCH net-next 2/4] net: add CONFIG_DEBUG_NET Eric Dumazet @ 2022-05-09 19:08 ` Eric Dumazet 2022-05-09 23:31 ` kernel test robot ` (2 more replies) 2022-05-09 19:08 ` [PATCH net-next 4/4] net: remove two BUG() from skb_checksum_help() Eric Dumazet 3 siblings, 3 replies; 12+ messages in thread From: Eric Dumazet @ 2022-05-09 19:08 UTC (permalink / raw) To: David S . Miller, Jakub Kicinski, Paolo Abeni Cc: netdev, Eric Dumazet, Eric Dumazet From: Eric Dumazet <edumazet@google.com> Make sure skb_transport_header() and skb_transport_offset() uses are not fooled if the transport header has not been set. This change will likely expose existing bugs in linux networking stacks. Signed-off-by: Eric Dumazet <edumazet@google.com> --- include/linux/skbuff.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index d58669d6cb91aa30edc70d59a0a7e9d4e2298842..a1c73fccccc68641fe46066e6d1195b31483ca4c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -42,6 +42,7 @@ #if IS_ENABLED(CONFIG_NF_CONNTRACK) #include <linux/netfilter/nf_conntrack_common.h> #endif +#include <net/net_debug.h> /* The interface for checksum offload between the stack and networking drivers * is as follows... @@ -2804,6 +2805,7 @@ static inline bool skb_transport_header_was_set(const struct sk_buff *skb) static inline unsigned char *skb_transport_header(const struct sk_buff *skb) { + DEBUG_NET_WARN_ON_ONCE(!skb_transport_header_was_set(skb)); return skb->head + skb->transport_header; } -- 2.36.0.512.ge40c2bad7a-goog ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 3/4] net: warn if transport header was not set 2022-05-09 19:08 ` [PATCH net-next 3/4] net: warn if transport header was not set Eric Dumazet @ 2022-05-09 23:31 ` kernel test robot 2022-05-09 23:52 ` Eric Dumazet 2022-05-09 23:31 ` kernel test robot 2022-05-09 23:51 ` kernel test robot 2 siblings, 1 reply; 12+ messages in thread From: kernel test robot @ 2022-05-09 23:31 UTC (permalink / raw) To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni Cc: kbuild-all, netdev, Eric Dumazet Hi Eric, I love your patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d config: arm-oxnas_v6_defconfig (https://download.01.org/0day-ci/archive/20220510/202205100723.9Wqso3nI-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 git checkout d316b61f313a417d7dfa97fa006320288f3af150 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/ethernet/stmicro/stmmac/ drivers/net/mdio/ net/core/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from include/linux/phy.h:16, from include/linux/fwnode_mdio.h:9, from drivers/net/mdio/of_mdio.c:13: >> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 6 | void netdev_printk(const char *level, const struct net_device *dev, | ^~~~~~~~~~ include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 9 | void netdev_emerg(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 11 | void netdev_alert(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 13 | void netdev_crit(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 19 | void netdev_notice(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ drivers/net/mdio/of_mdio.c: In function 'of_phy_get_and_connect': drivers/net/mdio/of_mdio.c:326:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 326 | netdev_err(dev, "broken fixed-link specification\n"); | ^~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from include/linux/phy.h:16, from include/linux/fwnode_mdio.h:9, from drivers/net/mdio/of_mdio.c:13: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ cc1: some warnings being treated as errors -- In file included from include/linux/skbuff.h:45, from include/linux/ip.h:16, from drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:20: >> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 6 | void netdev_printk(const char *level, const struct net_device *dev, | ^~~~~~~~~~ include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 9 | void netdev_emerg(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 11 | void netdev_alert(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 13 | void netdev_crit(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 19 | void netdev_notice(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ In file included from include/linux/skbuff.h:45, from include/linux/ip.h:16, from drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:20: drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_eee_init': drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:486:40: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types] 486 | netdev_dbg(priv->dev, "disable EEE\n"); | ~~~~^~~~~ | | | struct net_device * include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg' 61 | netdev_printk(KERN_DEBUG, __dev, format, ##args); \ | ^~~~~ include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 6 | void netdev_printk(const char *level, const struct net_device *dev, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:520:24: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types] 520 | netdev_dbg(priv->dev, "Energy-Efficient Ethernet initialized\n"); | ~~~~^~~~~ | | | struct net_device * include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg' 61 | netdev_printk(KERN_DEBUG, __dev, format, ##args); \ | ^~~~~ include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 6 | void netdev_printk(const char *level, const struct net_device *dev, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_get_tx_hwtstamp': drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:560:32: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types] 560 | netdev_dbg(priv->dev, "get valid TX hw timestamp %llu\n", ns); | ~~~~^~~~~ | | | struct net_device * include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg' 61 | netdev_printk(KERN_DEBUG, __dev, format, ##args); \ | ^~~~~ include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 6 | void netdev_printk(const char *level, const struct net_device *dev, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_get_rx_hwtstamp': drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:594:32: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types] 594 | netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns); | ~~~~^~~~~ | | | struct net_device * include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg' 61 | netdev_printk(KERN_DEBUG, __dev, format, ##args); \ | ^~~~~ include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 6 | void netdev_printk(const char *level, const struct net_device *dev, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:599:32: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types] 599 | netdev_dbg(priv->dev, "cannot get RX hw timestamp\n"); | ~~~~^~~~~ | | | struct net_device * include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg' 61 | netdev_printk(KERN_DEBUG, __dev, format, ##args); \ | ^~~~~ include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 6 | void netdev_printk(const char *level, const struct net_device *dev, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_hwtstamp_set': drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:628:34: error: passing argument 1 of 'netdev_alert' from incompatible pointer type [-Werror=incompatible-pointer-types] 628 | netdev_alert(priv->dev, "No support for HW time stamping\n"); | ~~~~^~~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from include/linux/ip.h:16, from drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:20: include/net/net_debug.h:11:44: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 11 | void netdev_alert(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:639:24: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types] 639 | netdev_dbg(priv->dev, "%s config flags:0x%x, tx_type:0x%x, rx_filter:0x%x\n", | ~~~~^~~~~ | | -- In file included from include/linux/skbuff.h:45, from include/linux/if_ether.h:19, from include/linux/etherdevice.h:20, from drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:11: >> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 6 | void netdev_printk(const char *level, const struct net_device *dev, | ^~~~~~~~~~ include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 9 | void netdev_emerg(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 11 | void netdev_alert(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 13 | void netdev_crit(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 19 | void netdev_notice(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c: In function 'stmmac_ethtool_op_set_eee': drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:803:33: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 803 | netdev_warn(priv->dev, | ~~~~^~~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from include/linux/if_ether.h:19, from include/linux/etherdevice.h:20, from drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:11: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ cc1: some warnings being treated as errors -- In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from include/linux/linkmode.h:5, from include/linux/mii.h:13, from drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c:16: >> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 6 | void netdev_printk(const char *level, const struct net_device *dev, | ^~~~~~~~~~ include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 9 | void netdev_emerg(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 11 | void netdev_alert(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 13 | void netdev_crit(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 19 | void netdev_notice(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ -- In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15: >> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 6 | void netdev_printk(const char *level, const struct net_device *dev, | ^~~~~~~~~~ include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 9 | void netdev_emerg(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 11 | void netdev_alert(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 13 | void netdev_crit(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 19 | void netdev_notice(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c: In function 'dwmac4_write_vlan_filter': drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:462:20: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 462 | netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n"); | ^~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c: In function 'dwmac4_add_hw_vlan_rx_fltr': drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:479:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 479 | netdev_err(dev, | ^~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:488:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 488 | netdev_warn(dev, "Adding VLAN ID 0 is not supported\n"); | ^~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:493:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 493 | netdev_err(dev, "Only single VLAN ID supported\n"); | ^~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:514:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 514 | netdev_err(dev, "MAC_VLAN_Tag_Filter full (size: %0u)\n", | ^~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c: In function 'dwmac4_del_hw_vlan_rx_fltr': drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:534:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 534 | netdev_err(dev, | ^~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from include/linux/netlink.h:7, from include/linux/ethtool.h:18, from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ cc1: some warnings being treated as errors .. vim +6 include/net/net_debug.h 877efca8201a88 Eric Dumazet 2022-05-09 4 877efca8201a88 Eric Dumazet 2022-05-09 5 __printf(3, 4) __cold 877efca8201a88 Eric Dumazet 2022-05-09 @6 void netdev_printk(const char *level, const struct net_device *dev, 877efca8201a88 Eric Dumazet 2022-05-09 7 const char *format, ...); 877efca8201a88 Eric Dumazet 2022-05-09 8 __printf(2, 3) __cold 877efca8201a88 Eric Dumazet 2022-05-09 9 void netdev_emerg(const struct net_device *dev, const char *format, ...); 877efca8201a88 Eric Dumazet 2022-05-09 10 __printf(2, 3) __cold 877efca8201a88 Eric Dumazet 2022-05-09 11 void netdev_alert(const struct net_device *dev, const char *format, ...); 877efca8201a88 Eric Dumazet 2022-05-09 12 __printf(2, 3) __cold 877efca8201a88 Eric Dumazet 2022-05-09 13 void netdev_crit(const struct net_device *dev, const char *format, ...); 877efca8201a88 Eric Dumazet 2022-05-09 14 __printf(2, 3) __cold 877efca8201a88 Eric Dumazet 2022-05-09 15 void netdev_err(const struct net_device *dev, const char *format, ...); 877efca8201a88 Eric Dumazet 2022-05-09 16 __printf(2, 3) __cold 877efca8201a88 Eric Dumazet 2022-05-09 17 void netdev_warn(const struct net_device *dev, const char *format, ...); 877efca8201a88 Eric Dumazet 2022-05-09 18 __printf(2, 3) __cold 877efca8201a88 Eric Dumazet 2022-05-09 19 void netdev_notice(const struct net_device *dev, const char *format, ...); 877efca8201a88 Eric Dumazet 2022-05-09 20 __printf(2, 3) __cold 877efca8201a88 Eric Dumazet 2022-05-09 21 void netdev_info(const struct net_device *dev, const char *format, ...); 877efca8201a88 Eric Dumazet 2022-05-09 22 -- 0-DAY CI Kernel Test Service https://01.org/lkp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 3/4] net: warn if transport header was not set 2022-05-09 23:31 ` kernel test robot @ 2022-05-09 23:52 ` Eric Dumazet 2022-05-10 1:30 ` Jakub Kicinski 0 siblings, 1 reply; 12+ messages in thread From: Eric Dumazet @ 2022-05-09 23:52 UTC (permalink / raw) To: kernel test robot Cc: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni, kbuild-all, netdev On Mon, May 9, 2022 at 4:32 PM kernel test robot <lkp@intel.com> wrote: > > Hi Eric, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on net-next/master] > > url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 > base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d > config: arm-oxnas_v6_defconfig (https://download.01.org/0day-ci/archive/20220510/202205100723.9Wqso3nI-lkp@intel.com/config) > compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0 > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150 > git remote add linux-review https://github.com/intel-lab-lkp/linux > git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 > git checkout d316b61f313a417d7dfa97fa006320288f3af150 > # save the config file > mkdir build_dir && cp config build_dir/.config > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/ethernet/stmicro/stmmac/ drivers/net/mdio/ net/core/ > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > I suppose some compiler/arches are asking us to add forward declaration for struct net_device. I have no idea what is the justification for that. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 3/4] net: warn if transport header was not set 2022-05-09 23:52 ` Eric Dumazet @ 2022-05-10 1:30 ` Jakub Kicinski 2022-05-10 2:11 ` Eric Dumazet 0 siblings, 1 reply; 12+ messages in thread From: Jakub Kicinski @ 2022-05-10 1:30 UTC (permalink / raw) To: Eric Dumazet Cc: kernel test robot, Eric Dumazet, David S . Miller, Paolo Abeni, kbuild-all, netdev On Mon, 9 May 2022 16:52:17 -0700 Eric Dumazet wrote: > On Mon, May 9, 2022 at 4:32 PM kernel test robot <lkp@intel.com> wrote: > > > > Hi Eric, > > > > I love your patch! Perhaps something to improve: > > > > [auto build test WARNING on net-next/master] > > > > url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d > > config: arm-oxnas_v6_defconfig (https://download.01.org/0day-ci/archive/20220510/202205100723.9Wqso3nI-lkp@intel.com/config) > > compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0 > > reproduce (this is a W=1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150 > > git remote add linux-review https://github.com/intel-lab-lkp/linux > > git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 > > git checkout d316b61f313a417d7dfa97fa006320288f3af150 > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/ethernet/stmicro/stmmac/ drivers/net/mdio/ net/core/ > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot <lkp@intel.com> > > > > I suppose some compiler/arches are asking us to add forward > declaration for struct net_device. > I have no idea what is the justification for that. Yeah the order of inclusion is skbuff -> netdevice, as you probably figured out by yourself. We may want to pull back the code move for the print helpers. Unless you have cycles to untangle that :S ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 3/4] net: warn if transport header was not set 2022-05-10 1:30 ` Jakub Kicinski @ 2022-05-10 2:11 ` Eric Dumazet 2022-05-10 2:23 ` Jakub Kicinski 0 siblings, 1 reply; 12+ messages in thread From: Eric Dumazet @ 2022-05-10 2:11 UTC (permalink / raw) To: Jakub Kicinski Cc: kernel test robot, Eric Dumazet, David S . Miller, Paolo Abeni, kbuild-all, netdev On Mon, May 9, 2022 at 6:30 PM Jakub Kicinski <kuba@kernel.org> wrote: > > > Yeah the order of inclusion is skbuff -> netdevice, as you probably > figured out by yourself. We may want to pull back the code move for > the print helpers. Unless you have cycles to untangle that :S I added at the beginning of the new file : #include <linux/bug.h> struct net_device; Hopefully this is enough. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 3/4] net: warn if transport header was not set 2022-05-10 2:11 ` Eric Dumazet @ 2022-05-10 2:23 ` Jakub Kicinski 0 siblings, 0 replies; 12+ messages in thread From: Jakub Kicinski @ 2022-05-10 2:23 UTC (permalink / raw) To: Eric Dumazet Cc: kernel test robot, Eric Dumazet, David S . Miller, Paolo Abeni, kbuild-all, netdev On Mon, 9 May 2022 19:11:15 -0700 Eric Dumazet wrote: > On Mon, May 9, 2022 at 6:30 PM Jakub Kicinski <kuba@kernel.org> wrote: > > Yeah the order of inclusion is skbuff -> netdevice, as you probably > > figured out by yourself. We may want to pull back the code move for > > the print helpers. Unless you have cycles to untangle that :S > > I added at the beginning of the new file : > > #include <linux/bug.h> > struct net_device; > > Hopefully this is enough. Maybe toss in linux/kern_levels.h for a good measure? netdev_WARN() uses netdev_name() but it's a macro, so the users of that will need to include netdevice.h, or we could leave netdev_WARN() in netdevice.h. Doesn't matter in practice. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 3/4] net: warn if transport header was not set 2022-05-09 19:08 ` [PATCH net-next 3/4] net: warn if transport header was not set Eric Dumazet 2022-05-09 23:31 ` kernel test robot @ 2022-05-09 23:31 ` kernel test robot 2022-05-09 23:51 ` kernel test robot 2 siblings, 0 replies; 12+ messages in thread From: kernel test robot @ 2022-05-09 23:31 UTC (permalink / raw) To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni Cc: kbuild-all, netdev, Eric Dumazet Hi Eric, I love your patch! Yet something to improve: [auto build test ERROR on net-next/master] url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220510/202205100711.cCKt89Rb-lkp@intel.com/config) compiler: gcc-11 (Debian 11.2.0-20) 11.2.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 git checkout d316b61f313a417d7dfa97fa006320288f3af150 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash drivers/net/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from include/linux/skbuff.h:45, from drivers/net/tun.c:44: include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 6 | void netdev_printk(const char *level, const struct net_device *dev, | ^~~~~~~~~~ include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 9 | void netdev_emerg(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 11 | void netdev_alert(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 13 | void netdev_crit(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 19 | void netdev_notice(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ In file included from include/linux/skbuff.h:45, from drivers/net/tun.c:44: drivers/net/tun.c: In function 'tun_flow_create': >> drivers/net/tun.c:380:47: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 380 | netif_info(tun, tx_queued, tun->dev, | ~~~^~~~~ | | | struct net_device * include/net/net_debug.h:101:32: note: in definition of macro 'netif_level' 101 | netdev_##level(dev, fmt, ##args); \ | ^~~ drivers/net/tun.c:380:17: note: in expansion of macro 'netif_info' 380 | netif_info(tun, tx_queued, tun->dev, | ^~~~~~~~~~ include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/tun.c: In function 'tun_flow_delete': drivers/net/tun.c:396:39: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 396 | netif_info(tun, tx_queued, tun->dev, "delete flow: hash %u index %u\n", | ~~~^~~~~ | | | struct net_device * include/net/net_debug.h:101:32: note: in definition of macro 'netif_level' 101 | netdev_##level(dev, fmt, ##args); \ | ^~~ drivers/net/tun.c:396:9: note: in expansion of macro 'netif_info' 396 | netif_info(tun, tx_queued, tun->dev, "delete flow: hash %u index %u\n", | ^~~~~~~~~~ include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/tun.c: In function 'tun_net_xmit': drivers/net/tun.c:1078:39: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 1078 | netif_info(tun, tx_queued, tun->dev, "%s %d\n", __func__, skb->len); | ~~~^~~~~ | | | struct net_device * include/net/net_debug.h:101:32: note: in definition of macro 'netif_level' 101 | netdev_##level(dev, fmt, ##args); \ | ^~~ drivers/net/tun.c:1078:9: note: in expansion of macro 'netif_info' 1078 | netif_info(tun, tx_queued, tun->dev, "%s %d\n", __func__, skb->len); | ^~~~~~~~~~ include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/tun.c: In function '__tun_chr_ioctl': drivers/net/tun.c:3095:33: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 3095 | netif_info(tun, drv, tun->dev, "tun_chr_ioctl cmd %u\n", cmd); | ~~~^~~~~ | | | struct net_device * include/net/net_debug.h:101:32: note: in definition of macro 'netif_level' 101 | netdev_##level(dev, fmt, ##args); \ | ^~~ drivers/net/tun.c:3095:9: note: in expansion of macro 'netif_info' 3095 | netif_info(tun, drv, tun->dev, "tun_chr_ioctl cmd %u\n", cmd); | ^~~~~~~~~~ include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/tun.c:3116:41: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 3116 | netif_info(tun, drv, tun->dev, "ignored: set checksum %s\n", | ~~~^~~~~ | | | struct net_device * include/net/net_debug.h:101:32: note: in definition of macro 'netif_level' 101 | netdev_##level(dev, fmt, ##args); \ | ^~~ drivers/net/tun.c:3116:17: note: in expansion of macro 'netif_info' 3116 | netif_info(tun, drv, tun->dev, "ignored: set checksum %s\n", | ^~~~~~~~~~ include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/tun.c:3135:41: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 3135 | netif_info(tun, drv, tun->dev, "persist %s\n", | ~~~^~~~~ | | | struct net_device * include/net/net_debug.h:101:32: note: in definition of macro 'netif_level' 101 | netdev_##level(dev, fmt, ##args); \ | ^~~ drivers/net/tun.c:3135:17: note: in expansion of macro 'netif_info' 3135 | netif_info(tun, drv, tun->dev, "persist %s\n", | ^~~~~~~~~~ include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/tun.c:3148:41: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 3148 | netif_info(tun, drv, tun->dev, "owner set to %u\n", | ~~~^~~~~ | | | struct net_device * include/net/net_debug.h:101:32: note: in definition of macro 'netif_level' 101 | netdev_##level(dev, fmt, ##args); \ | ^~~ drivers/net/tun.c:3148:17: note: in expansion of macro 'netif_info' 3148 | netif_info(tun, drv, tun->dev, "owner set to %u\n", | ^~~~~~~~~~ include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ vim +/netdev_info +380 drivers/net/tun.c 96442e42429e5f Jason Wang 2012-10-31 372 96442e42429e5f Jason Wang 2012-10-31 373 static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun, 96442e42429e5f Jason Wang 2012-10-31 374 struct hlist_head *head, 96442e42429e5f Jason Wang 2012-10-31 375 u32 rxhash, u16 queue_index) 96442e42429e5f Jason Wang 2012-10-31 376 { 9fdc6bef5f1e8b Eric Dumazet 2012-12-21 377 struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC); 9fdc6bef5f1e8b Eric Dumazet 2012-12-21 378 96442e42429e5f Jason Wang 2012-10-31 379 if (e) { 3424170f37e78c Michal Kubecek 2020-03-04 @380 netif_info(tun, tx_queued, tun->dev, 3424170f37e78c Michal Kubecek 2020-03-04 381 "create flow: hash %u index %u\n", 96442e42429e5f Jason Wang 2012-10-31 382 rxhash, queue_index); 96442e42429e5f Jason Wang 2012-10-31 383 e->updated = jiffies; 96442e42429e5f Jason Wang 2012-10-31 384 e->rxhash = rxhash; 9bc8893937c836 Tom Herbert 2013-12-22 385 e->rps_rxhash = 0; 96442e42429e5f Jason Wang 2012-10-31 386 e->queue_index = queue_index; 96442e42429e5f Jason Wang 2012-10-31 387 e->tun = tun; 96442e42429e5f Jason Wang 2012-10-31 388 hlist_add_head_rcu(&e->hash_link, head); b8732fb7f8920e Jason Wang 2013-01-23 389 ++tun->flow_count; 96442e42429e5f Jason Wang 2012-10-31 390 } 96442e42429e5f Jason Wang 2012-10-31 391 return e; 96442e42429e5f Jason Wang 2012-10-31 392 } 96442e42429e5f Jason Wang 2012-10-31 393 -- 0-DAY CI Kernel Test Service https://01.org/lkp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 3/4] net: warn if transport header was not set 2022-05-09 19:08 ` [PATCH net-next 3/4] net: warn if transport header was not set Eric Dumazet 2022-05-09 23:31 ` kernel test robot 2022-05-09 23:31 ` kernel test robot @ 2022-05-09 23:51 ` kernel test robot 2 siblings, 0 replies; 12+ messages in thread From: kernel test robot @ 2022-05-09 23:51 UTC (permalink / raw) To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni Cc: kbuild-all, netdev, Eric Dumazet Hi Eric, I love your patch! Yet something to improve: [auto build test ERROR on net-next/master] url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d config: x86_64-randconfig-m001-20220509 (https://download.01.org/0day-ci/archive/20220510/202205100711.gqvHz9Km-lkp@intel.com/config) compiler: gcc-11 (Debian 11.2.0-20) 11.2.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145 git checkout d316b61f313a417d7dfa97fa006320288f3af150 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/can/ctucanfd/ drivers/net/can/spi/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 6 | void netdev_printk(const char *level, const struct net_device *dev, | ^~~~~~~~~~ include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 9 | void netdev_emerg(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 11 | void netdev_alert(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 13 | void netdev_crit(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 19 | void netdev_notice(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ^~~~~~~~~~ In file included from include/linux/can/dev.h:18, from drivers/net/can/ctucanfd/ctucanfd.h:24, from drivers/net/can/ctucanfd/ctucanfd_base.c:35: include/linux/can/bittiming.h: In function 'can_calc_bittiming': include/linux/can/bittiming.h:127:20: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 127 | netdev_err(dev, "bit-timing calculation not available\n"); | ^~~ | | | const struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'const struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from drivers/net/can/ctucanfd/ctucanfd.h:24, from drivers/net/can/ctucanfd/ctucanfd_base.c:35: include/linux/can/dev.h: In function 'can_set_static_ctrlmode': include/linux/can/dev.h:141:29: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 141 | netdev_warn(dev, | ^~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_reset': >> drivers/net/can/ctucanfd/ctucanfd_base.c:190:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 190 | netdev_warn(ndev, "device did not leave reset\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_set_btr': >> drivers/net/can/ctucanfd/ctucanfd_base.c:214:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 214 | netdev_err(ndev, "BUG! Cannot set bittiming - CAN is enabled\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_set_secondary_sample_point': drivers/net/can/ctucanfd/ctucanfd_base.c:298:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 298 | netdev_err(ndev, "BUG! Cannot set SSP - CAN is enabled\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:308:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 308 | netdev_warn(ndev, "SSP offset saturated to 127\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_do_set_mode': drivers/net/can/ctucanfd/ctucanfd_base.c:455:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 455 | netdev_err(ndev, "ctucan_chip_start failed!\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_start_xmit': drivers/net/can/ctucanfd/ctucanfd_base.c:608:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 608 | netdev_err(ndev, "BUG!, no TXB free when queue awake!\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:617:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 617 | netdev_err(ndev, "BUG! TXNF set but cannot insert frame into TXTB! HW Bug?"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_err_interrupt': >> drivers/net/can/ctucanfd/ctucanfd_base.c:817:29: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 817 | netdev_info(ndev, "%s: ISR = 0x%08x, rxerr %d, txerr %d, error type %lu, pos %lu, ALC id_field %lu, bit %lu\n", | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:832:29: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 832 | netdev_info(ndev, "state changes from %s to %s\n", | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:837:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 837 | netdev_warn(ndev, | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:876:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 876 | netdev_warn(ndev, "unhandled error state (%d:%s)!\n", | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:885:37: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 885 | netdev_info(ndev, "arbitration lost\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:895:29: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 895 | netdev_info(ndev, "bus error\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_rx_poll': drivers/net/can/ctucanfd/ctucanfd_base.c:944:29: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 944 | netdev_info(ndev, "rx_poll: rx fifo overflow\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_tx_interrupt': drivers/net/can/ctucanfd/ctucanfd_base.c:1033:45: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 1033 | netdev_warn(ndev, "TXB in Error state\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:1042:45: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 1042 | netdev_warn(ndev, "TXB in Aborted state\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:1051:52: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 1051 | netdev_err(ndev, | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); -- | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:1161:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 1161 | netdev_err(ndev, "txb[%d] txb status=0x%08x\n", i, status); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_open': drivers/net/can/ctucanfd/ctucanfd_base.c:1209:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 1209 | netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:1222:29: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types] 1222 | netdev_warn(ndev, "open_candev failed!\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 17 | void netdev_warn(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:1228:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 1228 | netdev_err(ndev, "irq allocation for CAN failed\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:1234:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 1234 | netdev_err(ndev, "ctucan_chip_start failed!\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:1238:21: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types] 1238 | netdev_info(ndev, "ctu_can_fd device registered\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 21 | void netdev_info(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_get_berr_counter': drivers/net/can/ctucanfd/ctucanfd_base.c:1293:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 1293 | netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", __func__, ret); | ^~~~ | | | const struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'const struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_probe_common': drivers/net/can/ctucanfd/ctucanfd_base.c:1406:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 1406 | netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/net/can/ctucanfd/ctucanfd_base.c:1417:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types] 1417 | netdev_err(ndev, "CTU_CAN_FD signature not found\n"); | ^~~~ | | | struct net_device * In file included from include/linux/skbuff.h:45, from drivers/net/can/ctucanfd/ctucanfd_base.c:28: include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 15 | void netdev_err(const struct net_device *dev, const char *format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ >> drivers/net/can/ctucanfd/ctucanfd_base.c:1441:20: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types] 1441 | netdev_dbg(ndev, "mem_base=0x%p irq=%d clock=%d, no. of txt buffers:%d\n", | ^~~~ | | | struct net_device * include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg' 61 | netdev_printk(KERN_DEBUG, __dev, format, ##args); \ | ^~~~~ include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *' 6 | void netdev_printk(const char *level, const struct net_device *dev, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ cc1: some warnings being treated as errors .. vim +/netdev_warn +190 drivers/net/can/ctucanfd/ctucanfd_base.c 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 168 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 169 /** 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 170 * ctucan_reset() - Issues software reset request to CTU CAN FD 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 171 * @ndev: Pointer to net_device structure 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 172 * 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 173 * Return: 0 for success, -%ETIMEDOUT if CAN controller does not leave reset 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 174 */ 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 175 static int ctucan_reset(struct net_device *ndev) 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 176 { 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 177 struct ctucan_priv *priv = netdev_priv(ndev); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 178 int i = 100; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 179 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 180 ctucan_write32(priv, CTUCANFD_MODE, REG_MODE_RST); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 181 clear_bit(CTUCANFD_FLAG_RX_FFW_BUFFERED, &priv->drv_flags); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 182 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 183 do { 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 184 u16 device_id = FIELD_GET(REG_DEVICE_ID_DEVICE_ID, 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 185 ctucan_read32(priv, CTUCANFD_DEVICE_ID)); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 186 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 187 if (device_id == 0xCAFD) 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 188 return 0; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 189 if (!i--) { 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 @190 netdev_warn(ndev, "device did not leave reset\n"); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 191 return -ETIMEDOUT; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 192 } 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 193 usleep_range(100, 200); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 194 } while (1); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 195 } 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 196 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 197 /** 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 198 * ctucan_set_btr() - Sets CAN bus bit timing in CTU CAN FD 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 199 * @ndev: Pointer to net_device structure 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 200 * @bt: Pointer to Bit timing structure 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 201 * @nominal: True - Nominal bit timing, False - Data bit timing 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 202 * 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 203 * Return: 0 - OK, -%EPERM if controller is enabled 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 204 */ 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 205 static int ctucan_set_btr(struct net_device *ndev, struct can_bittiming *bt, bool nominal) 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 206 { 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 207 struct ctucan_priv *priv = netdev_priv(ndev); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 208 int max_ph1_len = 31; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 209 u32 btr = 0; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 210 u32 prop_seg = bt->prop_seg; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 211 u32 phase_seg1 = bt->phase_seg1; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 212 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 213 if (CTU_CAN_FD_ENABLED(priv)) { 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 @214 netdev_err(ndev, "BUG! Cannot set bittiming - CAN is enabled\n"); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 215 return -EPERM; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 216 } 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 217 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 218 if (nominal) 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 219 max_ph1_len = 63; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 220 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 221 /* The timing calculation functions have only constraints on tseg1, which is prop_seg + 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 222 * phase1_seg combined. tseg1 is then split in half and stored into prog_seg and phase_seg1. 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 223 * In CTU CAN FD, PROP is 6/7 bits wide but PH1 only 6/5, so we must re-distribute the 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 224 * values here. 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 225 */ 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 226 if (phase_seg1 > max_ph1_len) { 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 227 prop_seg += phase_seg1 - max_ph1_len; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 228 phase_seg1 = max_ph1_len; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 229 bt->prop_seg = prop_seg; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 230 bt->phase_seg1 = phase_seg1; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 231 } 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 232 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 233 if (nominal) { 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 234 btr = FIELD_PREP(REG_BTR_PROP, prop_seg); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 235 btr |= FIELD_PREP(REG_BTR_PH1, phase_seg1); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 236 btr |= FIELD_PREP(REG_BTR_PH2, bt->phase_seg2); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 237 btr |= FIELD_PREP(REG_BTR_BRP, bt->brp); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 238 btr |= FIELD_PREP(REG_BTR_SJW, bt->sjw); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 239 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 240 ctucan_write32(priv, CTUCANFD_BTR, btr); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 241 } else { 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 242 btr = FIELD_PREP(REG_BTR_FD_PROP_FD, prop_seg); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 243 btr |= FIELD_PREP(REG_BTR_FD_PH1_FD, phase_seg1); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 244 btr |= FIELD_PREP(REG_BTR_FD_PH2_FD, bt->phase_seg2); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 245 btr |= FIELD_PREP(REG_BTR_FD_BRP_FD, bt->brp); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 246 btr |= FIELD_PREP(REG_BTR_FD_SJW_FD, bt->sjw); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 247 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 248 ctucan_write32(priv, CTUCANFD_BTR_FD, btr); 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 249 } 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 250 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 251 return 0; 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 252 } 2dcb8e8782d8e4 Martin Jerabek 2022-03-22 253 -- 0-DAY CI Kernel Test Service https://01.org/lkp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net-next 4/4] net: remove two BUG() from skb_checksum_help() 2022-05-09 19:08 [PATCH net-next 0/4] net: CONFIG_DEBUG_NET and friends Eric Dumazet ` (2 preceding siblings ...) 2022-05-09 19:08 ` [PATCH net-next 3/4] net: warn if transport header was not set Eric Dumazet @ 2022-05-09 19:08 ` Eric Dumazet 3 siblings, 0 replies; 12+ messages in thread From: Eric Dumazet @ 2022-05-09 19:08 UTC (permalink / raw) To: David S . Miller, Jakub Kicinski, Paolo Abeni Cc: netdev, Eric Dumazet, Eric Dumazet From: Eric Dumazet <edumazet@google.com> I have a syzbot report that managed to get a crash in skb_checksum_help() If syzbot can trigger these BUG(), it makes sense to replace them with more friendly WARN_ON_ONCE() since skb_checksum_help() can instead return an error code. Note that syzbot will still crash there, until real bug is fixed. Signed-off-by: Eric Dumazet <edumazet@google.com> --- net/core/dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index f036ccb61da4da3ffc52c4f2402427054b831e8a..e12f8310dd86b312092c5d8fd50fa2ab60fce310 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3265,11 +3265,15 @@ int skb_checksum_help(struct sk_buff *skb) } offset = skb_checksum_start_offset(skb); - BUG_ON(offset >= skb_headlen(skb)); + ret = -EINVAL; + if (WARN_ON_ONCE(offset >= skb_headlen(skb))) + goto out; + csum = skb_checksum(skb, offset, skb->len - offset, 0); offset += skb->csum_offset; - BUG_ON(offset + sizeof(__sum16) > skb_headlen(skb)); + if (WARN_ON_ONCE(offset + sizeof(__sum16) > skb_headlen(skb))) + goto out; ret = skb_ensure_writable(skb, offset + sizeof(__sum16)); if (ret) -- 2.36.0.512.ge40c2bad7a-goog ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-05-10 2:23 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-05-09 19:08 [PATCH net-next 0/4] net: CONFIG_DEBUG_NET and friends Eric Dumazet 2022-05-09 19:08 ` [PATCH net-next 1/4] net: add include/net/net_debug.h Eric Dumazet 2022-05-09 19:08 ` [PATCH net-next 2/4] net: add CONFIG_DEBUG_NET Eric Dumazet 2022-05-09 19:08 ` [PATCH net-next 3/4] net: warn if transport header was not set Eric Dumazet 2022-05-09 23:31 ` kernel test robot 2022-05-09 23:52 ` Eric Dumazet 2022-05-10 1:30 ` Jakub Kicinski 2022-05-10 2:11 ` Eric Dumazet 2022-05-10 2:23 ` Jakub Kicinski 2022-05-09 23:31 ` kernel test robot 2022-05-09 23:51 ` kernel test robot 2022-05-09 19:08 ` [PATCH net-next 4/4] net: remove two BUG() from skb_checksum_help() Eric Dumazet
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).