Hello Andrey Ignatov, This is a semi-automatic email about new static checker warnings. The patch 96a6b93b6988: "rtnetlink: Return correct error on changing device netns" from Aug 25, 2021, leads to the following Smatch complaint: net/core/rtnetlink.c:2698 do_setlink() error: we previously assumed 'ifname' could be null (see line 2608) net/core/rtnetlink.c 2607 if (tb[IFLA_NET_NS_PID] || tb[IFLA_NET_NS_FD] || tb[IFLA_TARGET_NETNSID]) { 2608 const char *pat = ifname && ifname[0] ? ifname : NULL; ^^^^^^ The patch adds a new check for if "ifname" is NULL. Is this required? 2609 struct net *net; 2610 int new_ifindex; 2611 2612 net = rtnl_link_get_net_capable(skb, dev_net(dev), 2613 tb, CAP_NET_ADMIN); 2614 if (IS_ERR(net)) { 2615 err = PTR_ERR(net); 2616 goto errout; 2617 } 2618 2619 if (tb[IFLA_NEW_IFINDEX]) 2620 new_ifindex = nla_get_s32(tb[IFLA_NEW_IFINDEX]); 2621 else 2622 new_ifindex = 0; 2623 2624 err = __dev_change_net_namespace(dev, net, pat, new_ifindex); 2625 put_net(net); 2626 if (err) 2627 goto errout; 2628 status |= DO_SETLINK_MODIFIED; 2629 } 2630 2631 if (tb[IFLA_MAP]) { 2632 struct rtnl_link_ifmap *u_map; 2633 struct ifmap k_map; 2634 2635 if (!ops->ndo_set_config) { 2636 err = -EOPNOTSUPP; 2637 goto errout; 2638 } 2639 2640 if (!netif_device_present(dev)) { 2641 err = -ENODEV; 2642 goto errout; 2643 } 2644 2645 u_map = nla_data(tb[IFLA_MAP]); 2646 k_map.mem_start = (unsigned long) u_map->mem_start; 2647 k_map.mem_end = (unsigned long) u_map->mem_end; 2648 k_map.base_addr = (unsigned short) u_map->base_addr; 2649 k_map.irq = (unsigned char) u_map->irq; 2650 k_map.dma = (unsigned char) u_map->dma; 2651 k_map.port = (unsigned char) u_map->port; 2652 2653 err = ops->ndo_set_config(dev, &k_map); 2654 if (err < 0) 2655 goto errout; 2656 2657 status |= DO_SETLINK_NOTIFY; 2658 } 2659 2660 if (tb[IFLA_ADDRESS]) { 2661 struct sockaddr *sa; 2662 int len; 2663 2664 len = sizeof(sa_family_t) + max_t(size_t, dev->addr_len, 2665 sizeof(*sa)); 2666 sa = kmalloc(len, GFP_KERNEL); 2667 if (!sa) { 2668 err = -ENOMEM; 2669 goto errout; 2670 } 2671 sa->sa_family = dev->type; 2672 memcpy(sa->sa_data, nla_data(tb[IFLA_ADDRESS]), 2673 dev->addr_len); 2674 err = dev_set_mac_address_user(dev, sa, extack); 2675 kfree(sa); 2676 if (err) 2677 goto errout; 2678 status |= DO_SETLINK_MODIFIED; 2679 } 2680 2681 if (tb[IFLA_MTU]) { 2682 err = dev_set_mtu_ext(dev, nla_get_u32(tb[IFLA_MTU]), extack); 2683 if (err < 0) 2684 goto errout; 2685 status |= DO_SETLINK_MODIFIED; 2686 } 2687 2688 if (tb[IFLA_GROUP]) { 2689 dev_set_group(dev, nla_get_u32(tb[IFLA_GROUP])); 2690 status |= DO_SETLINK_NOTIFY; 2691 } 2692 2693 /* 2694 * Interface selected by interface index but interface 2695 * name provided implies that a name change has been 2696 * requested. 2697 */ 2698 if (ifm->ifi_index > 0 && ifname[0]) { ^^^^^^^^^ The existing code does not check. 2699 err = dev_change_name(dev, ifname); 2700 if (err < 0) regards, dan carpenter