kmemdup() cleanup in net/
Subsystems (11)
PATCH 1/1 kmemdup() cleanup in net/
hi,
replace open coded kmemdup() to save some screen space, and allow inlining/not inlining to be triggered by gcc.
net/atm/lec.c renamed from net/atm/lec.c.orig +2 -4
@@ -1321,11 +1321,10 @@ static int lane2_resolve(struct net_deviif (table =NULL )return -1 ; - *tlvs =kmalloc (table->sizeoftlvs,GFP_ATOMIC ); + *tlvs =kmemdup (table->tlvs, table->sizeoftlvs,GFP_ATOMIC );if (*tlvs =NULL )return -1 ; -memcpy (*tlvs, table->tlvs, table->sizeoftlvs); *sizeoftlvs = table->sizeoftlvs;return 0 ;
@@ -1364,11 +1363,10 @@ static int lane2_associate_req(struct nekfree (priv->tlvs);/* NULL if there was no previous association */ - priv->tlvs =kmalloc (sizeoftlvs,GFP_KERNEL ); + priv->tlvs =kmemdup (tlvs, sizeoftlvs,GFP_KERNEL );if (priv->tlvs =NULL )return (0 ); priv->sizeoftlvs = sizeoftlvs; -memcpy (priv->tlvs, tlvs, sizeoftlvs); skb =alloc_skb (sizeoftlvs,GFP_ATOMIC );if (skb =NULL )
net/ax25/ax25_out.c renamed from net/ax25/ax25_out.c.orig +1 -2
@@ -70,11 +70,10 @@ ax25_cb *ax25_send_frame(struct sk_buff ax25->dest_addr = *dest;if (digi !=NULL ) { -if ((ax25->digipeat =kmalloc (sizeof (ax25_digi),GFP_ATOMIC )) =NULL ) { +if ((ax25->digipeat =kmemdup (digi,sizeof (ax25_digi),GFP_ATOMIC )) =NULL ) {ax25_cb_put (ax25);return NULL ; } -memcpy (ax25->digipeat, digi,sizeof (ax25_digi)); }switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL ]) {
net/ax25/ax25_route.c renamed from net/ax25/ax25_route.c.orig +2 -2
@@ -432,11 +432,11 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25 }if (ax25_rt->digipeat !=NULL ) { -if ((ax25->digipeat =kmalloc (sizeof (ax25_digi),GFP_ATOMIC )) =NULL ) { +if ((ax25->digipeat =kmemdup (ax25_rt->digipeat, +sizeof (ax25_digi),GFP_ATOMIC )) =NULL ) { err = -ENOMEM ; goto put; } -memcpy (ax25->digipeat, ax25_rt->digipeat,sizeof (ax25_digi));ax25_adjust_path (addr, ax25->digipeat); }
net/core/neighbour.c renamed from net/core/neighbour.c.orig +1 -2
@@ -1266,10 +1266,9 @@ void pneigh_enqueue(struct neigh_table *struct neigh_parms *neigh_parms_alloc (struct net_device *dev,struct neigh_table *tbl) { -struct neigh_parms *p =kmalloc (sizeof (*p),GFP_KERNEL ); +struct neigh_parms *p =kmemdup (&tbl->parms,sizeof (*p),GFP_KERNEL );if (p) { -memcpy (p, &tbl->parms,sizeof (*p)); p->tbl = tbl;atomic_set (&p->refcnt,1 );INIT_RCU_HEAD (&p->rcu_head);
net/dccp/feat.c renamed from net/dccp/feat.c.orig +4 -8
@@ -279,12 +279,11 @@ static int dccp_feat_nn(struct sock *sk,if (opt =NULL )return -ENOMEM ; - copy =kmalloc (len,GFP_ATOMIC ); + copy =kmemdup (val, len,GFP_ATOMIC );if (copy =NULL ) {kfree (opt);return -ENOMEM ; } -memcpy (copy, val, len); opt->dccpop_type =DCCPO_CONFIRM_R ;/* NN can only confirm R */ opt->dccpop_feat = feature;
@@ -501,20 +500,18 @@ int dccp_feat_clone(struct sock *oldsk,list_for_each_entry (opt, &olddmsk->dccpms_pending, dccpop_node) {struct dccp_opt_pend *newopt;/* copy the value of the option */ -u8 *val =kmalloc (opt->dccpop_len,GFP_ATOMIC ); +u8 *val =kmemdup (opt->dccpop_val, opt->dccpop_len,GFP_ATOMIC );if (val =NULL ) goto out_clean; -memcpy (val, opt->dccpop_val, opt->dccpop_len); - newopt =kmalloc (sizeof (*newopt),GFP_ATOMIC ); + newopt =kmemdup (opt,sizeof (*newopt),GFP_ATOMIC );if (newopt =NULL ) {kfree (val); goto out_clean; }/* insert the option */ -memcpy (newopt, opt,sizeof (*newopt)); newopt->dccpop_val = val;list_add_tail (&newopt->dccpop_node, &newdmsk->dccpms_pending);
@@ -545,10 +542,9 @@ static int __dccp_feat_init(struct dccp_ u8 *val, u8 len) { int rc = -ENOMEM; -u8 *copy =kmalloc (len,GFP_KERNEL ); +u8 *copy =kmemdup (val, len,GFP_KERNEL );if (copy !=NULL ) { -memcpy (copy, val, len); rc =dccp_feat_change (dmsk, type, feat, copy, len,GFP_KERNEL );if (rc)kfree (copy);
net/decnet/dn_dev.c renamed from net/decnet/dn_dev.c.orig +1 -3
@@ -255,12 +255,10 @@ static void dn_dev_sysctl_register(strucstruct dn_dev_sysctl_table *t;int i; - t =kmalloc (sizeof (*t),GFP_KERNEL ); + t =kmemdup (&dn_dev_sysctl,sizeof (*t),GFP_KERNEL );if (t =NULL )return ; -memcpy (t, &dn_dev_sysctl,sizeof (*t)); -for (i =0 ; i <ARRAY_SIZE (t->dn_dev_vars) -1 ; i++) {long offset = (long )t->dn_dev_vars[i].data; t->dn_dev_vars[i].data = ((char *)parms) + offset;
net/ieee80211/softmac/ieee80211softmac_auth.c renamed from net/ieee80211/softmac/ieee80211softmac_auth.c.orig +1 -2
@@ -218,8 +218,7 @@ ieee80211softmac_auth_resp(struct net_de net->challenge_len =WLAN_AUTH_CHALLENGE_LEN ;if (net->challenge !=NULL )kfree (net->challenge); - net->challenge =kmalloc (net->challenge_len,GFP_ATOMIC ); -memcpy (net->challenge, data, net->challenge_len); + net->challenge =kmemdup (data, net->challenge_len,GFP_ATOMIC ); aq->state =IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE ;/* We reuse the work struct from the auth request here.
net/ipv4/ipvs/ip_vs_app.c renamed from net/ipv4/ipvs/ip_vs_app.c.orig +1 -2
@@ -80,10 +80,9 @@ ip_vs_app_inc_new(struct ip_vs_app *app,if (!pp->unregister_app)return -EOPNOTSUPP ; - inc =kmalloc (sizeof (struct ip_vs_app ),GFP_KERNEL ); + inc =kmemdup (app,sizeof (struct ip_vs_app ),GFP_KERNEL );if (!inc)return -ENOMEM ; -memcpy (inc, app,sizeof (*inc));INIT_LIST_HEAD (&inc->p_list);INIT_LIST_HEAD (&inc->incs_list); inc->app = app;
net/ipv4/ipvs/ip_vs_proto.c renamed from net/ipv4/ipvs/ip_vs_proto.c.orig +1 -7
@@ -118,13 +118,7 @@ void ip_vs_protocol_timeout_change(int fint *ip_vs_create_timeout_table (int *table,int size) { -int *t; - - t =kmalloc (size,GFP_ATOMIC ); -if (t =NULL ) -return NULL ; -memcpy (t, table, size); -return t; +return kmemdup (table, size,GFP_ATOMIC ); }
net/ipv4/cipso_ipv4.c renamed from net/ipv4/cipso_ipv4.c.orig +1 -2
@@ -377,12 +377,11 @@ int cipso_v4_cache_add(const struct sk_b entry =kzalloc (sizeof (*entry),GFP_ATOMIC );if (entry =NULL )return -ENOMEM ; - entry->key =kmalloc (cipso_ptr_len,GFP_ATOMIC ); + entry->key =kmemdup (cisco_ptr, cipso_ptr_len,GFP_ATOMIC );if (entry->key =NULL ) { ret_val = -ENOMEM ; goto cache_add_failure; } -memcpy (entry->key, cipso_ptr, cipso_ptr_len); entry->key_len = cipso_ptr_len; entry->hash =cipso_v4_map_cache_hash (cipso_ptr, cipso_ptr_len);atomic_inc (&secattr->cache->refcount);
net/ipv6/addrconf.c renamed from net/ipv6/addrconf.c.orig +1 -2
@@ -3982,10 +3982,9 @@ static void addrconf_sysctl_register(strstruct addrconf_sysctl_table *t;char *dev_name =NULL ; - t =kmalloc (sizeof (*t),GFP_KERNEL ); + t =kmemdup (&addrconf_sysctl,sizeof (*t),GFP_KERNEL );if (t =NULL )return ; -memcpy (t, &addrconf_sysctl,sizeof (*t));for (i=0 ; t->addrconf_vars[i].data; i++) { t->addrconf_vars[i].data += (char *)p - (char *)&ipv6_devconf; t->addrconf_vars[i].de =NULL ;
net/irda/irias_object.c renamed from net/irda/irias_object.c.orig +1 -2
@@ -501,13 +501,12 @@ struct ias_value *irias_new_octseq_value len =IAS_MAX_OCTET_STRING ; value->len = len; - value->t.oct_seq =kmalloc (len,GFP_ATOMIC ); + value->t.oct_seq =kmemdup (octseq, len,GFP_ATOMIC );if (value->t.oct_seq =NULL ){IRDA_WARNING ("%s: Unable to kmalloc!\n" , __FUNCTION__);kfree (value);return NULL ; } -memcpy (value->t.oct_seq, octseq , len);return value; }
net/netrom/nr_route.c renamed from net/netrom/nr_route.c.orig +4 -5
@@ -155,14 +155,13 @@ static int nr_add_node(ax25_address *nr,atomic_set (&nr_neigh->refcount,1 );if (ax25_digi !=NULL && ax25_digi->ndigi >0 ) { -if ((nr_neigh->digipeat =kmalloc (sizeof (*ax25_digi),GFP_KERNEL )) =NULL ) { +if ((nr_neigh->digipeat =kmemdup (ax25_digi, +sizeof (*ax25_digi),GFP_KERNEL )) =NULL ) {kfree (nr_neigh);if (nr_node)nr_node_put (nr_node);return -ENOMEM ; } -memcpy (nr_neigh->digipeat, ax25_digi, -sizeof (*ax25_digi)); }spin_lock_bh (&nr_neigh_list_lock);
@@ -432,11 +431,11 @@ static int nr_add_neigh(ax25_address *caatomic_set (&nr_neigh->refcount,1 );if (ax25_digi !=NULL && ax25_digi->ndigi >0 ) { -if ((nr_neigh->digipeat =kmalloc (sizeof (*ax25_digi),GFP_KERNEL )) =NULL ) { +if ((nr_neigh->digipeat =kmemdup (ax25_digi, +sizeof (*ax25_digi),GFP_KERNEL )) =NULL ) {kfree (nr_neigh);return -ENOMEM ; } -memcpy (nr_neigh->digipeat, ax25_digi,sizeof (*ax25_digi)); }spin_lock_bh (&nr_neigh_list_lock);
net/sched/act_ipt.c renamed from net/sched/act_ipt.c.orig +1 -2
@@ -156,10 +156,9 @@ static int tcf_ipt_init(struct rtattr *r rtattr_strlcpy(tname, tb[TCA_IPT_TABLE-1], IFNAMSIZ) >= IFNAMSIZ)strcpy (tname,"mangle" ); - t =kmalloc (td->u.target_size,GFP_KERNEL ); + t =kmemdup (td, td->u.target_size,GFP_KERNEL );if (unlikely (!t)) goto err2; -memcpy (t, td, td->u.target_size);if ((err =ipt_init_target (t, tname, hook)) <0 ) goto err3;
net/sched/act_simple.c renamed from net/sched/act_simple.c.orig +1 -2
@@ -71,11 +71,10 @@ static int tcf_simp_release(struct tcf_dstatic int alloc_defdata (struct tcf_defact *d,u32 datalen,void *defdata) { - d->tcfd_defdata =kmalloc (datalen,GFP_KERNEL ); + d->tcfd_defdata =kmemdup (defdata, datalen,GFP_KERNEL );if (unlikely (!d->tcfd_defdata))return -ENOMEM ; d->tcfd_datalen = datalen; -memcpy (d->tcfd_defdata, defdata, datalen);return 0 ; }
net/sched/ematch.c renamed from net/sched/ematch.c.orig +1 -2
@@ -251,12 +251,11 @@ static int tcf_em_validate(struct tcf_pr goto errout; em->data = *(u32 *) data; }else { -void *v =kmalloc (data_len,GFP_KERNEL ); +void *v =kmemdup (data, data_len,GFP_KERNEL );if (v =NULL ) { err = -ENOBUFS ; goto errout; } -memcpy (v, data, data_len); em->data = (unsigned long ) v; } }
net/sctp/sm_make_chunk.c renamed from net/sctp/sm_make_chunk.c.orig +1 -2
@@ -1910,10 +1910,9 @@ int sctp_process_init(struct sctp_associ/* Copy cookie in case we need to resend COOKIE-ECHO. */ cookie = asoc->peer.cookie;if (cookie) { - asoc->peer.cookie =kmalloc (asoc->peer.cookie_len, gfp); + asoc->peer.cookie =kmemdup (cookie, asoc->peer.cookie_len, gfp);if (!asoc->peer.cookie) goto clean_up; -memcpy (asoc->peer.cookie, cookie, asoc->peer.cookie_len); }/* RFC 2960 7.2.1 The initial value of ssthresh MAY be arbitrarily
net/sunrpc/auth_gss/auth_gss.c renamed from net/sunrpc/auth_gss/auth_gss.c.orig +1 -2
@@ -198,11 +198,10 @@ simple_get_netobj(const void *p, const v q = (const void *)((const char *)p + len);if (unlikely (q > end || q < p))return ERR_PTR (-EFAULT ); - dest->data =kmalloc (len,GFP_KERNEL ); + dest->data =kmemdup (p, len,GFP_KERNEL );if (unlikely (dest->data =NULL ))return ERR_PTR (-ENOMEM ); dest->len = len; -memcpy (dest->data, p, len);return q; }
net/sunrpc/auth_gss/gss_krb5_mech.c renamed from net/sunrpc/auth_gss/gss_krb5_mech.c.orig +1 -2
@@ -70,10 +70,9 @@ simple_get_netobj(const void *p, const v q = (const void *)((const char *)p + len);if (unlikely (q > end || q < p))return ERR_PTR (-EFAULT ); - res->data =kmalloc (len,GFP_KERNEL ); + res->data =kmemdup (p, len,GFP_KERNEL );if (unlikely (res->data =NULL ))return ERR_PTR (-ENOMEM ); -memcpy (res->data, p, len); res->len = len;return q; }
net/sunrpc/auth_gss/gss_spkm3_mech.c renamed from net/sunrpc/auth_gss/gss_spkm3_mech.c.orig +1 -2
@@ -76,10 +76,9 @@ simple_get_netobj(const void *p, const v q = (const void *)((const char *)p + len);if (unlikely (q > end || q < p))return ERR_PTR (-EFAULT ); - res->data =kmalloc (len,GFP_KERNEL ); + res->data =kmemdup (p, len,GFP_KERNEL );if (unlikely (res->data =NULL ))return ERR_PTR (-ENOMEM ); -memcpy (res->data, p, len);return q; }
net/sunrpc/clnt.c renamed from net/sunrpc/clnt.c.orig +1 -2
@@ -253,10 +253,9 @@ rpc_clone_client(struct rpc_clnt *clnt) {struct rpc_clnt *new; - new =kmalloc (sizeof (*new),GFP_KERNEL ); + new =kmemdup (clnt,sizeof (*new),GFP_KERNEL );if (!new) goto out_no_clnt; -memcpy (new, clnt,sizeof (*new));atomic_set (&new->cl_count,1 );atomic_set (&new->cl_users,0 ); new->cl_parent = clnt;
net/xfrm/xfrm_user.c renamed from net/xfrm/xfrm_user.c.orig +3 -6
@@ -244,11 +244,10 @@ static int attach_one_algo(struct xfrm_a *props = algo->desc.sadb_alg_id; len =sizeof (*ualg) + (ualg->alg_key_len +7U ) /8 ; - p =kmalloc (len,GFP_KERNEL ); + p =kmemdup (ualg, len,GFP_KERNEL );if (!p)return -ENOMEM ; -memcpy (p, ualg, len);strcpy (p->alg_name, algo->name); *algpp = p;return 0 ;
@@ -263,11 +262,10 @@ static int attach_encap_tmpl(struct xfrmreturn 0 ; uencap =RTA_DATA (rta); - p =kmalloc (sizeof (*p),GFP_KERNEL ); + p =kmemdup (uencap,sizeof (*p),GFP_KERNEL );if (!p)return -ENOMEM ; -memcpy (p, uencap,sizeof (*p)); *encapp = p;return 0 ; }
@@ -305,11 +303,10 @@ static int attach_one_addr(xfrm_address_return 0 ; uaddrp =RTA_DATA (rta); - p =kmalloc (sizeof (*p),GFP_KERNEL ); + p =kmemdup (uaddrp,sizeof (*p),GFP_KERNEL );if (!p)return -ENOMEM ; -memcpy (p, uaddrp,sizeof (*p)); *addrpp = p;return 0 ; }
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
arg, i thought i compile tested everything, please use this version.
net/atm/lec.c renamed from net/atm/lec.c.orig +2 -4
@@ -1321,11 +1321,10 @@ static int lane2_resolve(struct net_deviif (table =NULL )return -1 ; - *tlvs =kmalloc (table->sizeoftlvs,GFP_ATOMIC ); + *tlvs =kmemdup (table->tlvs, table->sizeoftlvs,GFP_ATOMIC );if (*tlvs =NULL )return -1 ; -memcpy (*tlvs, table->tlvs, table->sizeoftlvs); *sizeoftlvs = table->sizeoftlvs;return 0 ;
@@ -1364,11 +1363,10 @@ static int lane2_associate_req(struct nekfree (priv->tlvs);/* NULL if there was no previous association */ - priv->tlvs =kmalloc (sizeoftlvs,GFP_KERNEL ); + priv->tlvs =kmemdup (tlvs, sizeoftlvs,GFP_KERNEL );if (priv->tlvs =NULL )return (0 ); priv->sizeoftlvs = sizeoftlvs; -memcpy (priv->tlvs, tlvs, sizeoftlvs); skb =alloc_skb (sizeoftlvs,GFP_ATOMIC );if (skb =NULL )
net/ax25/ax25_out.c renamed from net/ax25/ax25_out.c.orig +1 -2
@@ -70,11 +70,10 @@ ax25_cb *ax25_send_frame(struct sk_buff ax25->dest_addr = *dest;if (digi !=NULL ) { -if ((ax25->digipeat =kmalloc (sizeof (ax25_digi),GFP_ATOMIC )) =NULL ) { +if ((ax25->digipeat =kmemdup (digi,sizeof (ax25_digi),GFP_ATOMIC )) =NULL ) {ax25_cb_put (ax25);return NULL ; } -memcpy (ax25->digipeat, digi,sizeof (ax25_digi)); }switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL ]) {
net/ax25/ax25_route.c renamed from net/ax25/ax25_route.c.orig +2 -2
@@ -432,11 +432,11 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25 }if (ax25_rt->digipeat !=NULL ) { -if ((ax25->digipeat =kmalloc (sizeof (ax25_digi),GFP_ATOMIC )) =NULL ) { +if ((ax25->digipeat =kmemdup (ax25_rt->digipeat, +sizeof (ax25_digi),GFP_ATOMIC )) =NULL ) { err = -ENOMEM ; goto put; } -memcpy (ax25->digipeat, ax25_rt->digipeat,sizeof (ax25_digi));ax25_adjust_path (addr, ax25->digipeat); }
net/core/neighbour.c renamed from net/core/neighbour.c.orig +1 -2
@@ -1266,10 +1266,9 @@ void pneigh_enqueue(struct neigh_table *struct neigh_parms *neigh_parms_alloc (struct net_device *dev,struct neigh_table *tbl) { -struct neigh_parms *p =kmalloc (sizeof (*p),GFP_KERNEL ); +struct neigh_parms *p =kmemdup (&tbl->parms,sizeof (*p),GFP_KERNEL );if (p) { -memcpy (p, &tbl->parms,sizeof (*p)); p->tbl = tbl;atomic_set (&p->refcnt,1 );INIT_RCU_HEAD (&p->rcu_head);
net/dccp/feat.c renamed from net/dccp/feat.c.orig +4 -8
@@ -279,12 +279,11 @@ static int dccp_feat_nn(struct sock *sk,if (opt =NULL )return -ENOMEM ; - copy =kmalloc (len,GFP_ATOMIC ); + copy =kmemdup (val, len,GFP_ATOMIC );if (copy =NULL ) {kfree (opt);return -ENOMEM ; } -memcpy (copy, val, len); opt->dccpop_type =DCCPO_CONFIRM_R ;/* NN can only confirm R */ opt->dccpop_feat = feature;
@@ -501,20 +500,18 @@ int dccp_feat_clone(struct sock *oldsk,list_for_each_entry (opt, &olddmsk->dccpms_pending, dccpop_node) {struct dccp_opt_pend *newopt;/* copy the value of the option */ -u8 *val =kmalloc (opt->dccpop_len,GFP_ATOMIC ); +u8 *val =kmemdup (opt->dccpop_val, opt->dccpop_len,GFP_ATOMIC );if (val =NULL ) goto out_clean; -memcpy (val, opt->dccpop_val, opt->dccpop_len); - newopt =kmalloc (sizeof (*newopt),GFP_ATOMIC ); + newopt =kmemdup (opt,sizeof (*newopt),GFP_ATOMIC );if (newopt =NULL ) {kfree (val); goto out_clean; }/* insert the option */ -memcpy (newopt, opt,sizeof (*newopt)); newopt->dccpop_val = val;list_add_tail (&newopt->dccpop_node, &newdmsk->dccpms_pending);
@@ -545,10 +542,9 @@ static int __dccp_feat_init(struct dccp_ u8 *val, u8 len) { int rc = -ENOMEM; -u8 *copy =kmalloc (len,GFP_KERNEL ); +u8 *copy =kmemdup (val, len,GFP_KERNEL );if (copy !=NULL ) { -memcpy (copy, val, len); rc =dccp_feat_change (dmsk, type, feat, copy, len,GFP_KERNEL );if (rc)kfree (copy);
net/decnet/dn_dev.c renamed from net/decnet/dn_dev.c.orig +1 -3
@@ -255,12 +255,10 @@ static void dn_dev_sysctl_register(strucstruct dn_dev_sysctl_table *t;int i; - t =kmalloc (sizeof (*t),GFP_KERNEL ); + t =kmemdup (&dn_dev_sysctl,sizeof (*t),GFP_KERNEL );if (t =NULL )return ; -memcpy (t, &dn_dev_sysctl,sizeof (*t)); -for (i =0 ; i <ARRAY_SIZE (t->dn_dev_vars) -1 ; i++) {long offset = (long )t->dn_dev_vars[i].data; t->dn_dev_vars[i].data = ((char *)parms) + offset;
net/ieee80211/softmac/ieee80211softmac_auth.c renamed from net/ieee80211/softmac/ieee80211softmac_auth.c.orig +1 -2
@@ -218,8 +218,7 @@ ieee80211softmac_auth_resp(struct net_de net->challenge_len =WLAN_AUTH_CHALLENGE_LEN ;if (net->challenge !=NULL )kfree (net->challenge); - net->challenge =kmalloc (net->challenge_len,GFP_ATOMIC ); -memcpy (net->challenge, data, net->challenge_len); + net->challenge =kmemdup (data, net->challenge_len,GFP_ATOMIC ); aq->state =IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE ;/* We reuse the work struct from the auth request here.
net/ipv4/ipvs/ip_vs_app.c renamed from net/ipv4/ipvs/ip_vs_app.c.orig +1 -2
@@ -80,10 +80,9 @@ ip_vs_app_inc_new(struct ip_vs_app *app,if (!pp->unregister_app)return -EOPNOTSUPP ; - inc =kmalloc (sizeof (struct ip_vs_app ),GFP_KERNEL ); + inc =kmemdup (app,sizeof (struct ip_vs_app ),GFP_KERNEL );if (!inc)return -ENOMEM ; -memcpy (inc, app,sizeof (*inc));INIT_LIST_HEAD (&inc->p_list);INIT_LIST_HEAD (&inc->incs_list); inc->app = app;
net/ipv4/ipvs/ip_vs_proto.c renamed from net/ipv4/ipvs/ip_vs_proto.c.orig +1 -7
@@ -118,13 +118,7 @@ void ip_vs_protocol_timeout_change(int fint *ip_vs_create_timeout_table (int *table,int size) { -int *t; - - t =kmalloc (size,GFP_ATOMIC ); -if (t =NULL ) -return NULL ; -memcpy (t, table, size); -return t; +return kmemdup (table, size,GFP_ATOMIC ); }
net/ipv6/addrconf.c renamed from net/ipv6/addrconf.c.orig +1 -2
@@ -3982,10 +3982,9 @@ static void addrconf_sysctl_register(strstruct addrconf_sysctl_table *t;char *dev_name =NULL ; - t =kmalloc (sizeof (*t),GFP_KERNEL ); + t =kmemdup (&addrconf_sysctl,sizeof (*t),GFP_KERNEL );if (t =NULL )return ; -memcpy (t, &addrconf_sysctl,sizeof (*t));for (i=0 ; t->addrconf_vars[i].data; i++) { t->addrconf_vars[i].data += (char *)p - (char *)&ipv6_devconf; t->addrconf_vars[i].de =NULL ;
net/irda/irias_object.c renamed from net/irda/irias_object.c.orig +1 -2
@@ -501,13 +501,12 @@ struct ias_value *irias_new_octseq_value len =IAS_MAX_OCTET_STRING ; value->len = len; - value->t.oct_seq =kmalloc (len,GFP_ATOMIC ); + value->t.oct_seq =kmemdup (octseq, len,GFP_ATOMIC );if (value->t.oct_seq =NULL ){IRDA_WARNING ("%s: Unable to kmalloc!\n" , __FUNCTION__);kfree (value);return NULL ; } -memcpy (value->t.oct_seq, octseq , len);return value; }
net/netrom/nr_route.c renamed from net/netrom/nr_route.c.orig +4 -5
@@ -155,14 +155,13 @@ static int nr_add_node(ax25_address *nr,atomic_set (&nr_neigh->refcount,1 );if (ax25_digi !=NULL && ax25_digi->ndigi >0 ) { -if ((nr_neigh->digipeat =kmalloc (sizeof (*ax25_digi),GFP_KERNEL )) =NULL ) { +if ((nr_neigh->digipeat =kmemdup (ax25_digi, +sizeof (*ax25_digi),GFP_KERNEL )) =NULL ) {kfree (nr_neigh);if (nr_node)nr_node_put (nr_node);return -ENOMEM ; } -memcpy (nr_neigh->digipeat, ax25_digi, -sizeof (*ax25_digi)); }spin_lock_bh (&nr_neigh_list_lock);
@@ -432,11 +431,11 @@ static int nr_add_neigh(ax25_address *caatomic_set (&nr_neigh->refcount,1 );if (ax25_digi !=NULL && ax25_digi->ndigi >0 ) { -if ((nr_neigh->digipeat =kmalloc (sizeof (*ax25_digi),GFP_KERNEL )) =NULL ) { +if ((nr_neigh->digipeat =kmemdup (ax25_digi, +sizeof (*ax25_digi),GFP_KERNEL )) =NULL ) {kfree (nr_neigh);return -ENOMEM ; } -memcpy (nr_neigh->digipeat, ax25_digi,sizeof (*ax25_digi)); }spin_lock_bh (&nr_neigh_list_lock);
net/sched/act_ipt.c renamed from net/sched/act_ipt.c.orig +1 -2
@@ -156,10 +156,9 @@ static int tcf_ipt_init(struct rtattr *r rtattr_strlcpy(tname, tb[TCA_IPT_TABLE-1], IFNAMSIZ) >= IFNAMSIZ)strcpy (tname,"mangle" ); - t =kmalloc (td->u.target_size,GFP_KERNEL ); + t =kmemdup (td, td->u.target_size,GFP_KERNEL );if (unlikely (!t)) goto err2; -memcpy (t, td, td->u.target_size);if ((err =ipt_init_target (t, tname, hook)) <0 ) goto err3;
net/sched/act_simple.c renamed from net/sched/act_simple.c.orig +1 -2
@@ -71,11 +71,10 @@ static int tcf_simp_release(struct tcf_dstatic int alloc_defdata (struct tcf_defact *d,u32 datalen,void *defdata) { - d->tcfd_defdata =kmalloc (datalen,GFP_KERNEL ); + d->tcfd_defdata =kmemdup (defdata, datalen,GFP_KERNEL );if (unlikely (!d->tcfd_defdata))return -ENOMEM ; d->tcfd_datalen = datalen; -memcpy (d->tcfd_defdata, defdata, datalen);return 0 ; }
net/sched/ematch.c renamed from net/sched/ematch.c.orig +1 -2
@@ -251,12 +251,11 @@ static int tcf_em_validate(struct tcf_pr goto errout; em->data = *(u32 *) data; }else { -void *v =kmalloc (data_len,GFP_KERNEL ); +void *v =kmemdup (data, data_len,GFP_KERNEL );if (v =NULL ) { err = -ENOBUFS ; goto errout; } -memcpy (v, data, data_len); em->data = (unsigned long ) v; } }
net/sctp/sm_make_chunk.c renamed from net/sctp/sm_make_chunk.c.orig +1 -2
@@ -1910,10 +1910,9 @@ int sctp_process_init(struct sctp_associ/* Copy cookie in case we need to resend COOKIE-ECHO. */ cookie = asoc->peer.cookie;if (cookie) { - asoc->peer.cookie =kmalloc (asoc->peer.cookie_len, gfp); + asoc->peer.cookie =kmemdup (cookie, asoc->peer.cookie_len, gfp);if (!asoc->peer.cookie) goto clean_up; -memcpy (asoc->peer.cookie, cookie, asoc->peer.cookie_len); }/* RFC 2960 7.2.1 The initial value of ssthresh MAY be arbitrarily
net/sunrpc/auth_gss/auth_gss.c renamed from net/sunrpc/auth_gss/auth_gss.c.orig +1 -2
@@ -198,11 +198,10 @@ simple_get_netobj(const void *p, const v q = (const void *)((const char *)p + len);if (unlikely (q > end || q < p))return ERR_PTR (-EFAULT ); - dest->data =kmalloc (len,GFP_KERNEL ); + dest->data =kmemdup (p, len,GFP_KERNEL );if (unlikely (dest->data =NULL ))return ERR_PTR (-ENOMEM ); dest->len = len; -memcpy (dest->data, p, len);return q; }
net/sunrpc/auth_gss/gss_krb5_mech.c renamed from net/sunrpc/auth_gss/gss_krb5_mech.c.orig +1 -2
@@ -70,10 +70,9 @@ simple_get_netobj(const void *p, const v q = (const void *)((const char *)p + len);if (unlikely (q > end || q < p))return ERR_PTR (-EFAULT ); - res->data =kmalloc (len,GFP_KERNEL ); + res->data =kmemdup (p, len,GFP_KERNEL );if (unlikely (res->data =NULL ))return ERR_PTR (-ENOMEM ); -memcpy (res->data, p, len); res->len = len;return q; }
net/sunrpc/auth_gss/gss_spkm3_mech.c renamed from net/sunrpc/auth_gss/gss_spkm3_mech.c.orig +1 -2
@@ -76,10 +76,9 @@ simple_get_netobj(const void *p, const v q = (const void *)((const char *)p + len);if (unlikely (q > end || q < p))return ERR_PTR (-EFAULT ); - res->data =kmalloc (len,GFP_KERNEL ); + res->data =kmemdup (p, len,GFP_KERNEL );if (unlikely (res->data =NULL ))return ERR_PTR (-ENOMEM ); -memcpy (res->data, p, len);return q; }
net/sunrpc/clnt.c renamed from net/sunrpc/clnt.c.orig +1 -2
@@ -253,10 +253,9 @@ rpc_clone_client(struct rpc_clnt *clnt) {struct rpc_clnt *new; - new =kmalloc (sizeof (*new),GFP_KERNEL ); + new =kmemdup (clnt,sizeof (*new),GFP_KERNEL );if (!new) goto out_no_clnt; -memcpy (new, clnt,sizeof (*new));atomic_set (&new->cl_count,1 );atomic_set (&new->cl_users,0 ); new->cl_parent = clnt;
net/xfrm/xfrm_user.c renamed from net/xfrm/xfrm_user.c.orig +3 -6
@@ -244,11 +244,10 @@ static int attach_one_algo(struct xfrm_a *props = algo->desc.sadb_alg_id; len =sizeof (*ualg) + (ualg->alg_key_len +7U ) /8 ; - p =kmalloc (len,GFP_KERNEL ); + p =kmemdup (ualg, len,GFP_KERNEL );if (!p)return -ENOMEM ; -memcpy (p, ualg, len);strcpy (p->alg_name, algo->name); *algpp = p;return 0 ;
@@ -263,11 +262,10 @@ static int attach_encap_tmpl(struct xfrmreturn 0 ; uencap =RTA_DATA (rta); - p =kmalloc (sizeof (*p),GFP_KERNEL ); + p =kmemdup (uencap,sizeof (*p),GFP_KERNEL );if (!p)return -ENOMEM ; -memcpy (p, uencap,sizeof (*p)); *encapp = p;return 0 ; }
@@ -305,11 +303,10 @@ static int attach_one_addr(xfrm_address_return 0 ; uaddrp =RTA_DATA (rta); - p =kmalloc (sizeof (*p),GFP_KERNEL ); + p =kmemdup (uaddrp,sizeof (*p),GFP_KERNEL );if (!p)return -ENOMEM ; -memcpy (p, uaddrp,sizeof (*p)); *addrpp = p;return 0 ; }
net/ipv4/cipso_ipv4.c renamed from net/ipv4/cipso_ipv4.c.orig +1 -2
@@ -377,12 +377,11 @@ int cipso_v4_cache_add(const struct sk_b entry =kzalloc (sizeof (*entry),GFP_ATOMIC );if (entry =NULL )return -ENOMEM ; - entry->key =kmalloc (cipso_ptr_len,GFP_ATOMIC ); + entry->key =kmemdup (cipso_ptr, cipso_ptr_len,GFP_ATOMIC );if (entry->key =NULL ) { ret_val = -ENOMEM ; goto cache_add_failure; } -memcpy (entry->key, cipso_ptr, cipso_ptr_len); entry->key_len = cipso_ptr_len; entry->hash =cipso_v4_map_cache_hash (cipso_ptr, cipso_ptr_len);atomic_inc (&secattr->cache->refcount);
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
David Miller
maintainerFrom: Eric Sesterhenn <[email protected]>
Date: Thu, 26 Oct 2006 22:49:31 +0200
Quoted 4 lines
arg, i thought i compile tested everything, please use this version.
Signed-off-by Eric Sesterhenn <[email protected]>
Definitely post-2.6.19 material, please resubmit when 2.6.20 merging opens up, thanks.
_______________________________________________
Kernel-janitors mailing list [email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors