CC: [email protected] CC: [email protected] CC: Linux Memory Management List <[email protected]> TO: Yajun Deng <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 7999516e20bd9bb5d1f7351cbd05ca529a3a8d60 commit: b37a466837393af72fe8bcb8f1436410f3f173f3 [5257/6030] netdevice: add the case if dev is NULL :::::: branch date: 2 days ago :::::: commit date: 3 days ago config: x86_64-randconfig-c001-20210807 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 41a6b50c25961addc04438b567ee1f4ef9e40f98) 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 # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b37a466837393af72fe8bcb8f1436410f3f173f3 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout b37a466837393af72fe8bcb8f1436410f3f173f3 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 4 warnings generated. include/linux/hid.h:1007:9: warning: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input') [clang-analyzer-core.NullDereference] input->name, c, type); ^ drivers/hid/hid-tivo.c:26:2: note: Control jumps to 'case 786432:' at line 41 switch (usage->hid & HID_USAGE_PAGE) { ^ drivers/hid/hid-tivo.c:42:3: note: Control jumps to 'case 521:' at line 46 switch (usage->hid & HID_USAGE) { ^ drivers/hid/hid-tivo.c:46:15: note: Calling 'hid_map_usage_clear' case 0x209: tivo_map_key_clear(KEY_INFO); break; ^ drivers/hid/hid-tivo.c:19:31: note: expanded from macro 'tivo_map_key_clear' #define tivo_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/hid.h:1035:2: note: Calling 'hid_map_usage' hid_map_usage(hidinput, usage, bit, max, type, c); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/hid.h:982:2: note: 'input' initialized here struct input_dev *input = hidinput->input; ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/hid.h:986:2: note: Control jumps to 'case 1:' at line 995 switch (type) { ^ include/linux/hid.h:998:3: note: Execution continues on line 1005 break; ^ include/linux/hid.h:1005:15: note: 'c' is <= 'limit' if (unlikely(c > limit || !bmap)) { ^ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ include/linux/hid.h:1005:15: note: Left side of '||' is false if (unlikely(c > limit || !bmap)) { ^ include/linux/hid.h:1005:28: note: Assuming 'bmap' is null if (unlikely(c > limit || !bmap)) { ^ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ include/linux/hid.h:1005:28: note: Assuming pointer value is null if (unlikely(c > limit || !bmap)) { ^ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ include/linux/hid.h:1005:2: note: Taking true branch if (unlikely(c > limit || !bmap)) { ^ include/linux/hid.h:1006:3: note: Assuming the condition is true pr_warn_ratelimited("%s: Invalid code %d type %d\n", ^ include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited' printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/printk.h:540:6: note: expanded from macro 'printk_ratelimited' if (__ratelimit(&_rs)) \ ^~~~~~~~~~~~~~~~~ include/linux/ratelimit_types.h:41:28: note: expanded from macro '__ratelimit' #define __ratelimit(state) ___ratelimit(state, __func__) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/hid.h:1006:3: note: Taking true branch pr_warn_ratelimited("%s: Invalid code %d type %d\n", ^ include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited' printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:540:2: note: expanded from macro 'printk_ratelimited' if (__ratelimit(&_rs)) \ ^ include/linux/hid.h:1007:9: note: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input') input->name, c, type); ^ include/linux/printk.h:557:49: note: expanded from macro 'pr_warn_ratelimited' printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/printk.h:541:17: note: expanded from macro 'printk_ratelimited' printk(fmt, ##__VA_ARGS__); \ ^~~~~~~~~~~ Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 4 warnings generated. >> include/net/netlink.h:1477:32: warning: Null pointer passed as 1st argument >> to string length function [clang-analyzer-unix.cstring.NullArg] return nla_put(skb, attrtype, strlen(str) + 1, str); ^ net/ieee802154/nl-phy.c:172:2: note: Taking false branch pr_debug("%s\n", __func__); ^ include/linux/printk.h:477:2: note: expanded from macro 'pr_debug' no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:140:2: note: expanded from macro 'no_printk' if (0) \ ^ net/ieee802154/nl-phy.c:174:6: note: Assuming the condition is false if (!info->attrs[IEEE802154_ATTR_PHY_NAME]) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/ieee802154/nl-phy.c:174:2: note: Taking false branch if (!info->attrs[IEEE802154_ATTR_PHY_NAME]) ^ net/ieee802154/nl-phy.c:178:6: note: Assuming the condition is false if (name[nla_len(info->attrs[IEEE802154_ATTR_PHY_NAME]) - 1] != '\0') ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/ieee802154/nl-phy.c:178:2: note: Taking false branch if (name[nla_len(info->attrs[IEEE802154_ATTR_PHY_NAME]) - 1] != '\0') ^ net/ieee802154/nl-phy.c:181:6: note: Assuming the condition is false if (info->attrs[IEEE802154_ATTR_DEV_NAME]) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/ieee802154/nl-phy.c:181:2: note: Taking false branch if (info->attrs[IEEE802154_ATTR_DEV_NAME]) { ^ net/ieee802154/nl-phy.c:192:2: note: Taking false branch if (strlen(devname) >= IFNAMSIZ) ^ net/ieee802154/nl-phy.c:196:6: note: Assuming 'phy' is non-null if (!phy) ^~~~ net/ieee802154/nl-phy.c:196:2: note: Taking false branch if (!phy) ^ net/ieee802154/nl-phy.c:200:6: note: Assuming 'msg' is non-null if (!msg) ^~~~ net/ieee802154/nl-phy.c:200:2: note: Taking false branch if (!msg) ^ net/ieee802154/nl-phy.c:203:6: note: Assuming pointer value is null if (info->attrs[IEEE802154_ATTR_HW_ADDR] && ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/ieee802154/nl-phy.c:203:43: note: Left side of '&&' is false if (info->attrs[IEEE802154_ATTR_HW_ADDR] && ^ net/ieee802154/nl-phy.c:210:6: note: Assuming the condition is false if (info->attrs[IEEE802154_ATTR_DEV_TYPE]) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/ieee802154/nl-phy.c:210:2: note: Taking false branch if (info->attrs[IEEE802154_ATTR_DEV_TYPE]) { ^ net/ieee802154/nl-phy.c:220:6: note: Calling 'IS_ERR' if (IS_ERR(dev)) { ^~~~~~~~~~~ include/linux/err.h:36:9: note: Assuming the condition is false return IS_ERR_VALUE((unsigned long)ptr); ^ include/linux/err.h:22:34: note: expanded from macro 'IS_ERR_VALUE' #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO) ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ include/linux/err.h:36:2: note: Returning zero, which participates in a condition later return IS_ERR_VALUE((unsigned long)ptr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/ieee802154/nl-phy.c:220:6: note: Returning from 'IS_ERR' if (IS_ERR(dev)) { ^~~~~~~~~~~ net/ieee802154/nl-phy.c:220:2: note: Taking false branch if (IS_ERR(dev)) { ^ net/ieee802154/nl-phy.c:226:2: note: Taking false branch if (info->attrs[IEEE802154_ATTR_HW_ADDR]) { ^ net/ieee802154/nl-phy.c:243:6: note: Assuming the condition is false if (nla_put_string(msg, IEEE802154_ATTR_PHY_NAME, wpan_phy_name(phy)) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/ieee802154/nl-phy.c:243:6: note: Left side of '||' is false net/ieee802154/nl-phy.c:244:52: note: Passing null pointer value via 3rd parameter 'str' nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name)) { ^~~~~~~~~ net/ieee802154/nl-phy.c:244:6: note: Calling 'nla_put_string' nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/net/netlink.h:1477:32: note: Null pointer passed as 1st argument to string length function return nla_put(skb, attrtype, strlen(str) + 1, str); ^ ~~~ Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). vim +1477 include/net/netlink.h 4778e0be16c291 Jiri Pirko 2012-07-27 1467 bfa83a9e03cf8d Thomas Graf 2005-11-10 1468 /** bfa83a9e03cf8d Thomas Graf 2005-11-10 1469 * nla_put_string - Add a string netlink attribute to a socket buffer bfa83a9e03cf8d Thomas Graf 2005-11-10 1470 * @skb: socket buffer to add attribute to bfa83a9e03cf8d Thomas Graf 2005-11-10 1471 * @attrtype: attribute type bfa83a9e03cf8d Thomas Graf 2005-11-10 1472 * @str: NUL terminated string bfa83a9e03cf8d Thomas Graf 2005-11-10 1473 */ bfa83a9e03cf8d Thomas Graf 2005-11-10 1474 static inline int nla_put_string(struct sk_buff *skb, int attrtype, bfa83a9e03cf8d Thomas Graf 2005-11-10 1475 const char *str) bfa83a9e03cf8d Thomas Graf 2005-11-10 1476 { bfa83a9e03cf8d Thomas Graf 2005-11-10 @1477 return nla_put(skb, attrtype, strlen(str) + 1, str); bfa83a9e03cf8d Thomas Graf 2005-11-10 1478 } bfa83a9e03cf8d Thomas Graf 2005-11-10 1479 :::::: The code at line 1477 was first introduced by commit :::::: bfa83a9e03cf8d501c6272999843470afecb32ed [NETLINK]: Type-safe netlink messages/attributes interface :::::: TO: Thomas Graf <[email protected]> :::::: CC: Thomas Graf <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
