treewide: rename nla_strlcpy to nla_strscpy.
authorFrancis Laniel <laniel_francis@privacyrequired.com>
Sun, 15 Nov 2020 17:08:06 +0000 (18:08 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 16 Nov 2020 16:08:54 +0000 (08:08 -0800)
Calls to nla_strlcpy are now replaced by calls to nla_strscpy which is the new
name of this function.

Signed-off-by: Francis Laniel <laniel_francis@privacyrequired.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
29 files changed:
drivers/infiniband/core/nldev.c
drivers/net/can/vxcan.c
drivers/net/veth.c
include/linux/genl_magic_struct.h
include/net/netlink.h
include/net/pkt_cls.h
kernel/taskstats.c
lib/nlattr.c
net/core/fib_rules.c
net/core/rtnetlink.c
net/decnet/dn_dev.c
net/ieee802154/nl-mac.c
net/ipv4/devinet.c
net/ipv4/fib_semantics.c
net/ipv4/metrics.c
net/netfilter/ipset/ip_set_hash_netiface.c
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink_acct.c
net/netfilter/nfnetlink_cthelper.c
net/netfilter/nft_ct.c
net/netfilter/nft_log.c
net/netlabel/netlabel_mgmt.c
net/nfc/netlink.c
net/sched/act_api.c
net/sched/act_ipt.c
net/sched/act_simple.c
net/sched/cls_api.c
net/sched/sch_api.c
net/tipc/netlink_compat.c

index 12d29d54a0812da5a778532ef0f1128f4ee10203..08366e254b1d1851912ccbf709fba55b3f98ce53 100644 (file)
@@ -932,7 +932,7 @@ static int nldev_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
        if (tb[RDMA_NLDEV_ATTR_DEV_NAME]) {
                char name[IB_DEVICE_NAME_MAX] = {};
 
-               nla_strlcpy(name, tb[RDMA_NLDEV_ATTR_DEV_NAME],
+               nla_strscpy(name, tb[RDMA_NLDEV_ATTR_DEV_NAME],
                            IB_DEVICE_NAME_MAX);
                if (strlen(name) == 0) {
                        err = -EINVAL;
@@ -1529,13 +1529,13 @@ static int nldev_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
            !tb[RDMA_NLDEV_ATTR_LINK_TYPE] || !tb[RDMA_NLDEV_ATTR_NDEV_NAME])
                return -EINVAL;
 
-       nla_strlcpy(ibdev_name, tb[RDMA_NLDEV_ATTR_DEV_NAME],
+       nla_strscpy(ibdev_name, tb[RDMA_NLDEV_ATTR_DEV_NAME],
                    sizeof(ibdev_name));
        if (strchr(ibdev_name, '%') || strlen(ibdev_name) == 0)
                return -EINVAL;
 
-       nla_strlcpy(type, tb[RDMA_NLDEV_ATTR_LINK_TYPE], sizeof(type));
-       nla_strlcpy(ndev_name, tb[RDMA_NLDEV_ATTR_NDEV_NAME],
+       nla_strscpy(type, tb[RDMA_NLDEV_ATTR_LINK_TYPE], sizeof(type));
+       nla_strscpy(ndev_name, tb[RDMA_NLDEV_ATTR_NDEV_NAME],
                    sizeof(ndev_name));
 
        ndev = dev_get_by_name(sock_net(skb->sk), ndev_name);
@@ -1602,7 +1602,7 @@ static int nldev_get_chardev(struct sk_buff *skb, struct nlmsghdr *nlh,
        if (err || !tb[RDMA_NLDEV_ATTR_CHARDEV_TYPE])
                return -EINVAL;
 
-       nla_strlcpy(client_name, tb[RDMA_NLDEV_ATTR_CHARDEV_TYPE],
+       nla_strscpy(client_name, tb[RDMA_NLDEV_ATTR_CHARDEV_TYPE],
                    sizeof(client_name));
 
        if (tb[RDMA_NLDEV_ATTR_DEV_INDEX]) {
index d6ba9426be4deb75f349a97d6641acffb332c533..fa47bab510bb90cb35bcc56fe9d0275dccc57cf4 100644 (file)
@@ -186,7 +186,7 @@ static int vxcan_newlink(struct net *net, struct net_device *dev,
        }
 
        if (ifmp && tbp[IFLA_IFNAME]) {
-               nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ);
+               nla_strscpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ);
                name_assign_type = NET_NAME_USER;
        } else {
                snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d");
@@ -223,7 +223,7 @@ static int vxcan_newlink(struct net *net, struct net_device *dev,
 
        /* register first device */
        if (tb[IFLA_IFNAME])
-               nla_strlcpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ);
+               nla_strscpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ);
        else
                snprintf(dev->name, IFNAMSIZ, DRV_NAME "%%d");
 
index 8c737668008a0d0edc23b18601f3a4a597d1fd86..359d3ab33c4db4fde18688598589543215b8e696 100644 (file)
@@ -1329,7 +1329,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
        }
 
        if (ifmp && tbp[IFLA_IFNAME]) {
-               nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ);
+               nla_strscpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ);
                name_assign_type = NET_NAME_USER;
        } else {
                snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d");
@@ -1379,7 +1379,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
                eth_hw_addr_random(dev);
 
        if (tb[IFLA_IFNAME])
-               nla_strlcpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ);
+               nla_strscpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ);
        else
                snprintf(dev->name, IFNAMSIZ, DRV_NAME "%%d");
 
index eeae59d3ceb7401af5badf6297ee2fad3a388fd7..35d21fddaf2d7d49f1d354a1e9541191fa24beaa 100644 (file)
@@ -89,7 +89,7 @@ static inline int nla_put_u64_0pad(struct sk_buff *skb, int attrtype, u64 value)
                        nla_get_u64, nla_put_u64_0pad, false)
 #define __str_field(attr_nr, attr_flag, name, maxlen) \
        __array(attr_nr, attr_flag, name, NLA_NUL_STRING, char, maxlen, \
-                       nla_strlcpy, nla_put, false)
+                       nla_strscpy, nla_put, false)
 #define __bin_field(attr_nr, attr_flag, name, maxlen) \
        __array(attr_nr, attr_flag, name, NLA_BINARY, char, maxlen, \
                        nla_memcpy, nla_put, false)
index 446ca182e13de3075f92846a642458df939b51e0..1ceec518ab497c2c9ced5059f2f1f5a8fb6f7873 100644 (file)
  * Attribute Misc:
  *   nla_memcpy(dest, nla, count)      copy attribute into memory
  *   nla_memcmp(nla, data, size)       compare attribute with memory area
- *   nla_strlcpy(dst, nla, size)       copy attribute to a sized string
+ *   nla_strscpy(dst, nla, size)       copy attribute to a sized string
  *   nla_strcmp(nla, str)              compare attribute with string
  *
  * Attribute Parsing:
@@ -506,7 +506,7 @@ int __nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
                struct netlink_ext_ack *extack);
 int nla_policy_len(const struct nla_policy *, int);
 struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype);
-ssize_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize);
+ssize_t nla_strscpy(char *dst, const struct nlattr *nla, size_t dstsize);
 char *nla_strdup(const struct nlattr *nla, gfp_t flags);
 int nla_memcpy(void *dest, const struct nlattr *src, int count);
 int nla_memcmp(const struct nlattr *nla, const void *data, size_t size);
index db9a828f4f4fa13a4a8ccdab0b9547347ca55178..133f9ad4d4f9b3fe8792d1b1086927af0a97532c 100644 (file)
@@ -512,7 +512,7 @@ tcf_change_indev(struct net *net, struct nlattr *indev_tlv,
        char indev[IFNAMSIZ];
        struct net_device *dev;
 
-       if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) < 0) {
+       if (nla_strscpy(indev, indev_tlv, IFNAMSIZ) < 0) {
                NL_SET_ERR_MSG_ATTR(extack, indev_tlv,
                                    "Interface name too long");
                return -EINVAL;
index a2802b6ff4bbee73e78a9944f7b6891604cea9db..2b4898b4752eda2af2eabaa590b2e301a57f9255 100644 (file)
@@ -346,7 +346,7 @@ static int parse(struct nlattr *na, struct cpumask *mask)
        data = kmalloc(len, GFP_KERNEL);
        if (!data)
                return -ENOMEM;
-       nla_strlcpy(data, na, len);
+       nla_strscpy(data, na, len);
        ret = cpulist_parse(data, mask);
        kfree(data);
        return ret;
index 447182543c03b58ea177b9ead60e3f8fa6469a56..09aa181569e03a4fe283fed5da70ac4096dedc57 100644 (file)
@@ -709,7 +709,7 @@ struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype)
 EXPORT_SYMBOL(nla_find);
 
 /**
- * nla_strlcpy - Copy string attribute payload into a sized buffer
+ * nla_strscpy - Copy string attribute payload into a sized buffer
  * @dst: Where to copy the string to.
  * @nla: Attribute to copy the string from.
  * @dstsize: Size of destination buffer.
@@ -722,7 +722,7 @@ EXPORT_SYMBOL(nla_find);
  * * -E2BIG - If @dstsize is 0 or greater than U16_MAX or @nla length greater
  *            than @dstsize.
  */
-ssize_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize)
+ssize_t nla_strscpy(char *dst, const struct nlattr *nla, size_t dstsize)
 {
        size_t srclen = nla_len(nla);
        char *src = nla_data(nla);
@@ -749,7 +749,7 @@ ssize_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize)
 
        return ret;
 }
-EXPORT_SYMBOL(nla_strlcpy);
+EXPORT_SYMBOL(nla_strscpy);
 
 /**
  * nla_strdup - Copy string attribute payload into a newly allocated buffer
index 7bcfb16854cbb436c3d5068bfd8b96e29b54bf17..cd80ffed6d267b58ffbece234f31bddc34a50d92 100644 (file)
@@ -563,7 +563,7 @@ static int fib_nl2rule(struct sk_buff *skb, struct nlmsghdr *nlh,
                struct net_device *dev;
 
                nlrule->iifindex = -1;
-               nla_strlcpy(nlrule->iifname, tb[FRA_IIFNAME], IFNAMSIZ);
+               nla_strscpy(nlrule->iifname, tb[FRA_IIFNAME], IFNAMSIZ);
                dev = __dev_get_by_name(net, nlrule->iifname);
                if (dev)
                        nlrule->iifindex = dev->ifindex;
@@ -573,7 +573,7 @@ static int fib_nl2rule(struct sk_buff *skb, struct nlmsghdr *nlh,
                struct net_device *dev;
 
                nlrule->oifindex = -1;
-               nla_strlcpy(nlrule->oifname, tb[FRA_OIFNAME], IFNAMSIZ);
+               nla_strscpy(nlrule->oifname, tb[FRA_OIFNAME], IFNAMSIZ);
                dev = __dev_get_by_name(net, nlrule->oifname);
                if (dev)
                        nlrule->oifindex = dev->ifindex;
index 7d72236917839f50687c8abbcdefb605cd6ce430..60917ff4a00b4bcffa21a0777c637f337419f2f8 100644 (file)
@@ -1939,7 +1939,7 @@ static const struct rtnl_link_ops *linkinfo_to_kind_ops(const struct nlattr *nla
        if (linfo[IFLA_INFO_KIND]) {
                char kind[MODULE_NAME_LEN];
 
-               nla_strlcpy(kind, linfo[IFLA_INFO_KIND], sizeof(kind));
+               nla_strscpy(kind, linfo[IFLA_INFO_KIND], sizeof(kind));
                ops = rtnl_link_ops_get(kind);
        }
 
@@ -2953,9 +2953,9 @@ static struct net_device *rtnl_dev_get(struct net *net,
        if (!ifname) {
                ifname = buffer;
                if (ifname_attr)
-                       nla_strlcpy(ifname, ifname_attr, IFNAMSIZ);
+                       nla_strscpy(ifname, ifname_attr, IFNAMSIZ);
                else if (altifname_attr)
-                       nla_strlcpy(ifname, altifname_attr, ALTIFNAMSIZ);
+                       nla_strscpy(ifname, altifname_attr, ALTIFNAMSIZ);
                else
                        return NULL;
        }
@@ -2983,7 +2983,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh,
                goto errout;
 
        if (tb[IFLA_IFNAME])
-               nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
+               nla_strscpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
        else
                ifname[0] = '\0';
 
@@ -3264,7 +3264,7 @@ replay:
                return err;
 
        if (tb[IFLA_IFNAME])
-               nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
+               nla_strscpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
        else
                ifname[0] = '\0';
 
@@ -3296,7 +3296,7 @@ replay:
                memset(linkinfo, 0, sizeof(linkinfo));
 
        if (linkinfo[IFLA_INFO_KIND]) {
-               nla_strlcpy(kind, linkinfo[IFLA_INFO_KIND], sizeof(kind));
+               nla_strscpy(kind, linkinfo[IFLA_INFO_KIND], sizeof(kind));
                ops = rtnl_link_ops_get(kind);
        } else {
                kind[0] = '\0';
index 15d42353f1a3803be1758d491a7685618f9dfc8e..d1c50a48614b584b9ee02aca2f0398b8c1f89182 100644 (file)
@@ -658,7 +658,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh,
        ifa->ifa_dev = dn_db;
 
        if (tb[IFA_LABEL])
-               nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
+               nla_strscpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
        else
                memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
 
index 6d091e419d3ee75550212633ea670e6f278c050a..9c640d670ffeb5dd879f042d8d8f8df4c68202ee 100644 (file)
@@ -149,7 +149,7 @@ static struct net_device *ieee802154_nl_get_dev(struct genl_info *info)
        if (info->attrs[IEEE802154_ATTR_DEV_NAME]) {
                char name[IFNAMSIZ + 1];
 
-               nla_strlcpy(name, info->attrs[IEEE802154_ATTR_DEV_NAME],
+               nla_strscpy(name, info->attrs[IEEE802154_ATTR_DEV_NAME],
                            sizeof(name));
                dev = dev_get_by_name(&init_net, name);
        } else if (info->attrs[IEEE802154_ATTR_DEV_INDEX]) {
index 43e04382c5937c589e3f585c14993956402e32d4..75f67994fc851f78a7b4068457adf085058b8dc6 100644 (file)
@@ -880,7 +880,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh,
                ifa->ifa_broadcast = nla_get_in_addr(tb[IFA_BROADCAST]);
 
        if (tb[IFA_LABEL])
-               nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
+               nla_strscpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
        else
                memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
 
index 7612ff6111a7b30c572fc19b7cc5e4e63164aebc..b5400cec4f69baefe99c797e5617bf880ca4c3dd 100644 (file)
@@ -973,7 +973,7 @@ bool fib_metrics_match(struct fib_config *cfg, struct fib_info *fi)
                        char tmp[TCP_CA_NAME_MAX];
                        bool ecn_ca = false;
 
-                       nla_strlcpy(tmp, nla, sizeof(tmp));
+                       nla_strscpy(tmp, nla, sizeof(tmp));
                        val = tcp_ca_get_key_by_name(fi->fib_net, tmp, &ecn_ca);
                } else {
                        if (nla_len(nla) != sizeof(u32))
index 3205d5f7c8c942921c82c50148acfd9501394d0b..25ea6ac44db955d8dd6a99ac6187c130e05a97b7 100644 (file)
@@ -31,7 +31,7 @@ static int ip_metrics_convert(struct net *net, struct nlattr *fc_mx,
                if (type == RTAX_CC_ALGO) {
                        char tmp[TCP_CA_NAME_MAX];
 
-                       nla_strlcpy(tmp, nla, sizeof(tmp));
+                       nla_strscpy(tmp, nla, sizeof(tmp));
                        val = tcp_ca_get_key_by_name(net, tmp, &ecn_ca);
                        if (val == TCP_CA_UNSPEC) {
                                NL_SET_ERR_MSG(extack, "Unknown tcp congestion algorithm");
index 3d74169b794c81ad087c463663dd026acc8bbe99..ddd51c2e1cb36a0f9185b2e6bbbe374081bfdaba 100644 (file)
@@ -226,7 +226,7 @@ hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[],
                if (e.cidr > HOST_MASK)
                        return -IPSET_ERR_INVALID_CIDR;
        }
-       nla_strlcpy(e.iface, tb[IPSET_ATTR_IFACE], IFNAMSIZ);
+       nla_strscpy(e.iface, tb[IPSET_ATTR_IFACE], IFNAMSIZ);
 
        if (tb[IPSET_ATTR_CADT_FLAGS]) {
                u32 cadt_flags = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]);
@@ -443,7 +443,7 @@ hash_netiface6_uadt(struct ip_set *set, struct nlattr *tb[],
 
        ip6_netmask(&e.ip, e.cidr);
 
-       nla_strlcpy(e.iface, tb[IPSET_ATTR_IFACE], IFNAMSIZ);
+       nla_strscpy(e.iface, tb[IPSET_ATTR_IFACE], IFNAMSIZ);
 
        if (tb[IPSET_ATTR_CADT_FLAGS]) {
                u32 cadt_flags = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]);
index bd0e12bf5770c9358997fb018d89c9b85a96df50..65aa98fc5eb643393448c269da0ce43524257b4b 100644 (file)
@@ -1282,7 +1282,7 @@ static struct nft_chain *nft_chain_lookup(struct net *net,
        if (nla == NULL)
                return ERR_PTR(-EINVAL);
 
-       nla_strlcpy(search, nla, sizeof(search));
+       nla_strscpy(search, nla, sizeof(search));
 
        WARN_ON(!rcu_read_lock_held() &&
                !lockdep_commit_lock_is_held(net));
@@ -1722,7 +1722,7 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net,
                goto err_hook_alloc;
        }
 
-       nla_strlcpy(ifname, attr, IFNAMSIZ);
+       nla_strscpy(ifname, attr, IFNAMSIZ);
        dev = __dev_get_by_name(net, ifname);
        if (!dev) {
                err = -ENOENT;
@@ -5735,7 +5735,7 @@ struct nft_object *nft_obj_lookup(const struct net *net,
        struct rhlist_head *tmp, *list;
        struct nft_object *obj;
 
-       nla_strlcpy(search, nla, sizeof(search));
+       nla_strscpy(search, nla, sizeof(search));
        k.name = search;
 
        WARN_ON_ONCE(!rcu_read_lock_held() &&
index 5bfec829c12f332201d44f98a11c89e836cd6321..5e511df8d709b5132c137dab6d80f2f316a0d32b 100644 (file)
@@ -112,7 +112,7 @@ static int nfnl_acct_new(struct net *net, struct sock *nfnl,
                nfacct->flags = flags;
        }
 
-       nla_strlcpy(nfacct->name, tb[NFACCT_NAME], NFACCT_NAME_MAX);
+       nla_strscpy(nfacct->name, tb[NFACCT_NAME], NFACCT_NAME_MAX);
 
        if (tb[NFACCT_BYTES]) {
                atomic64_set(&nfacct->bytes,
index 5b0d0a77379c64bce6c55ba185022b95d1554ec6..0f94fce1d3ed3dde7a8ceb4b75d2243ef3671baf 100644 (file)
@@ -146,7 +146,7 @@ nfnl_cthelper_expect_policy(struct nf_conntrack_expect_policy *expect_policy,
            !tb[NFCTH_POLICY_EXPECT_TIMEOUT])
                return -EINVAL;
 
-       nla_strlcpy(expect_policy->name,
+       nla_strscpy(expect_policy->name,
                    tb[NFCTH_POLICY_NAME], NF_CT_HELPER_NAME_LEN);
        expect_policy->max_expected =
                ntohl(nla_get_be32(tb[NFCTH_POLICY_EXPECT_MAX]));
@@ -233,7 +233,7 @@ nfnl_cthelper_create(const struct nlattr * const tb[],
        if (ret < 0)
                goto err1;
 
-       nla_strlcpy(helper->name,
+       nla_strscpy(helper->name,
                    tb[NFCTH_NAME], NF_CT_HELPER_NAME_LEN);
        size = ntohl(nla_get_be32(tb[NFCTH_PRIV_DATA_LEN]));
        if (size > sizeof_field(struct nf_conn_help, data)) {
index 322bd674963ee009fcc01f56e6f3b50e248031f6..a8c4d442231c51e7b5cc61f3d93d87be54f48fe1 100644 (file)
@@ -990,7 +990,7 @@ static int nft_ct_helper_obj_init(const struct nft_ctx *ctx,
        if (!priv->l4proto)
                return -ENOENT;
 
-       nla_strlcpy(name, tb[NFTA_CT_HELPER_NAME], sizeof(name));
+       nla_strscpy(name, tb[NFTA_CT_HELPER_NAME], sizeof(name));
 
        if (tb[NFTA_CT_HELPER_L3PROTO])
                family = ntohs(nla_get_be16(tb[NFTA_CT_HELPER_L3PROTO]));
index 57899454a5303181b9fb5cc51dc4ea20950f4703..a06a46b039c5ba9d7269f8572e7725846a37a53b 100644 (file)
@@ -152,7 +152,7 @@ static int nft_log_init(const struct nft_ctx *ctx,
                priv->prefix = kmalloc(nla_len(nla) + 1, GFP_KERNEL);
                if (priv->prefix == NULL)
                        return -ENOMEM;
-               nla_strlcpy(priv->prefix, nla, nla_len(nla) + 1);
+               nla_strscpy(priv->prefix, nla, nla_len(nla) + 1);
        } else {
                priv->prefix = (char *)nft_log_null_prefix;
        }
index eb1d66d20afbbfcf834db5a7f38f9b2f9be54a1f..df1b41ed73fd9f732eadc12e6e9d125944a916a0 100644 (file)
@@ -95,7 +95,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info,
                        ret_val = -ENOMEM;
                        goto add_free_entry;
                }
-               nla_strlcpy(entry->domain,
+               nla_strscpy(entry->domain,
                            info->attrs[NLBL_MGMT_A_DOMAIN], tmp_size);
        }
 
index 8709f3d4e7c4b51421ba2b929e842b152810842c..573b38ad2f8ed91e1f46d12213d7890cf9ca2c6c 100644 (file)
@@ -1226,7 +1226,7 @@ static int nfc_genl_fw_download(struct sk_buff *skb, struct genl_info *info)
        if (!dev)
                return -ENODEV;
 
-       nla_strlcpy(firmware_name, info->attrs[NFC_ATTR_FIRMWARE_NAME],
+       nla_strscpy(firmware_name, info->attrs[NFC_ATTR_FIRMWARE_NAME],
                    sizeof(firmware_name));
 
        rc = nfc_fw_download(dev, firmware_name);
index fe540a89b16c571701cf321023f5e218035e2b28..fc23f46a315c49919d671d884f13f861ef7cf2f7 100644 (file)
@@ -939,7 +939,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
                        NL_SET_ERR_MSG(extack, "TC action kind must be specified");
                        goto err_out;
                }
-               if (nla_strlcpy(act_name, kind, IFNAMSIZ) < 0) {
+               if (nla_strscpy(act_name, kind, IFNAMSIZ) < 0) {
                        NL_SET_ERR_MSG(extack, "TC action name too long");
                        goto err_out;
                }
index 8dc3bec0d3258a020145352dd38dfde58be21099..ac7297f423559dd39c0227101cac2bffedbaf750 100644 (file)
@@ -166,7 +166,7 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla,
        if (unlikely(!tname))
                goto err1;
        if (tb[TCA_IPT_TABLE] == NULL ||
-           nla_strlcpy(tname, tb[TCA_IPT_TABLE], IFNAMSIZ) >= IFNAMSIZ)
+           nla_strscpy(tname, tb[TCA_IPT_TABLE], IFNAMSIZ) >= IFNAMSIZ)
                strcpy(tname, "mangle");
 
        t = kmemdup(td, td->u.target_size, GFP_KERNEL);
index a4f3d0f0daa969f4e78e363ff01f9d42991ee323..726cc956d06fccd5a79b483a6063d0cc61bd8e68 100644 (file)
@@ -52,7 +52,7 @@ static int alloc_defdata(struct tcf_defact *d, const struct nlattr *defdata)
        d->tcfd_defdata = kzalloc(SIMP_MAX_DATA, GFP_KERNEL);
        if (unlikely(!d->tcfd_defdata))
                return -ENOMEM;
-       nla_strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
+       nla_strscpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
        return 0;
 }
 
@@ -71,7 +71,7 @@ static int reset_policy(struct tc_action *a, const struct nlattr *defdata,
        spin_lock_bh(&d->tcf_lock);
        goto_ch = tcf_action_set_ctrlact(a, p->action, goto_ch);
        memset(d->tcfd_defdata, 0, SIMP_MAX_DATA);
-       nla_strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
+       nla_strscpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
        spin_unlock_bh(&d->tcf_lock);
        if (goto_ch)
                tcf_chain_put_by_act(goto_ch);
index c2e9661e20d3ef03f9e0e87bef9d59721ecd7e29..ff3e943febaa2c52ab6057152b9d7e735e1cc9be 100644 (file)
@@ -223,7 +223,7 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp)
 static bool tcf_proto_check_kind(struct nlattr *kind, char *name)
 {
        if (kind)
-               return nla_strlcpy(name, kind, IFNAMSIZ) < 0;
+               return nla_strscpy(name, kind, IFNAMSIZ) < 0;
        memset(name, 0, IFNAMSIZ);
        return false;
 }
index 05449286d889e83d6c9d7003acddfc3a4499929b..1a2d2471b07884210ce2accaab242ce78c47b5ab 100644 (file)
@@ -1170,7 +1170,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
 #ifdef CONFIG_MODULES
        if (ops == NULL && kind != NULL) {
                char name[IFNAMSIZ];
-               if (nla_strlcpy(name, kind, IFNAMSIZ) >= 0) {
+               if (nla_strscpy(name, kind, IFNAMSIZ) >= 0) {
                        /* We dropped the RTNL semaphore in order to
                         * perform the module load.  So, even if we
                         * succeeded in loading the module we have to
index 5c6206c9d6a8a7c7047af5c7473a2acf5bc53a9c..82f154989418e7c832b25f983e457f0568d06990 100644 (file)
@@ -696,7 +696,7 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg,
 
        link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]);
        link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP]));
-       nla_strlcpy(link_info.str, link[TIPC_NLA_LINK_NAME],
+       nla_strscpy(link_info.str, link[TIPC_NLA_LINK_NAME],
                    TIPC_MAX_LINK_NAME);
 
        return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO,