Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Fri, 21 Jul 2006 23:44:45 +0000 (16:44 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 21 Jul 2006 23:44:45 +0000 (16:44 -0700)
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (21 commits)
  [TIPC]: Removing useless casts
  [IPV4]: Fix nexthop realm dumping for multipath routes
  [DUMMY]: Avoid an oops when dummy_init_one() failed
  [IFB] After ifb_init_one() failed, i is increased. Decrease
  [NET]: Fix reversed error test in netif_tx_trylock
  [MAINTAINERS]: Mark LAPB as Oprhan.
  [NET]: Conversions from kmalloc+memset to k(z|c)alloc.
  [NET]: sun happymeal, little pci cleanup
  [IrDA]: Use alloc_skb() in IrDA TX path
  [I/OAT]: Remove pci_module_init() from Intel I/OAT DMA engine
  [I/OAT]: net/core/user_dma.c should #include <net/netdma.h>
  [SCTP]: ADDIP: Don't use an address as source until it is ASCONF-ACKed
  [SCTP]: Set chunk->data_accepted only if we are going to accept it.
  [SCTP]: Verify all the paths to a peer via heartbeat before using them.
  [SCTP]: Unhash the endpoint in sctp_endpoint_free().
  [SCTP]: Check for NULL arg to sctp_bucket_destroy().
  [PKT_SCHED] netem: Fix slab corruption with netem (2nd try)
  [WAN]: Converted synclink drivers to use netif_carrier_*()
  [WAN]: Cosmetic changes to N2 and C101 drivers
  [WAN]: Added missing netif_dormant_off() to generic HDLC
  ...

141 files changed:
MAINTAINERS
drivers/char/pcmcia/synclink_cs.c
drivers/char/synclink.c
drivers/char/synclink_gt.c
drivers/char/synclinkmp.c
drivers/dma/ioatdma.c
drivers/net/dummy.c
drivers/net/ifb.c
drivers/net/sunhme.c
drivers/net/wan/c101.c
drivers/net/wan/hdlc_ppp.c
drivers/net/wan/hdlc_raw.c
drivers/net/wan/hdlc_raw_eth.c
drivers/net/wan/hdlc_x25.c
drivers/net/wan/n2.c
include/linux/netdevice.h
include/net/netdma.h
include/net/sctp/structs.h
include/net/sctp/user.h
net/8021q/vlan.c
net/appletalk/ddp.c
net/atm/br2684.c
net/atm/clip.c
net/atm/lec.c
net/atm/mpc.c
net/atm/pppoatm.c
net/atm/resources.c
net/ax25/sysctl_net_ax25.c
net/bridge/br_ioctl.c
net/core/user_dma.c
net/decnet/dn_dev.c
net/decnet/dn_fib.c
net/decnet/dn_neigh.c
net/decnet/dn_rules.c
net/decnet/dn_table.c
net/econet/af_econet.c
net/ieee80211/ieee80211_crypt.c
net/ieee80211/ieee80211_crypt_ccmp.c
net/ieee80211/ieee80211_crypt_wep.c
net/ieee80211/ieee80211_wx.c
net/ieee80211/softmac/ieee80211softmac_io.c
net/ipv4/ah4.c
net/ipv4/arp.c
net/ipv4/devinet.c
net/ipv4/esp4.c
net/ipv4/fib_hash.c
net/ipv4/fib_rules.c
net/ipv4/fib_semantics.c
net/ipv4/igmp.c
net/ipv4/inet_diag.c
net/ipv4/ip_gre.c
net/ipv4/ip_options.c
net/ipv4/ipcomp.c
net/ipv4/ipip.c
net/ipv4/ipmr.c
net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/ipvs/ip_vs_est.c
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/ipv4/tcp_ipv4.c
net/ipv4/udp.c
net/ipv4/xfrm4_mode_tunnel.c
net/ipv6/ip6_tunnel.c
net/ipv6/sit.c
net/irda/af_irda.c
net/irda/ircomm/ircomm_core.c
net/irda/ircomm/ircomm_lmp.c
net/irda/ircomm/ircomm_param.c
net/irda/ircomm/ircomm_tty.c
net/irda/irda_device.c
net/irda/iriap.c
net/irda/iriap_event.c
net/irda/irias_object.c
net/irda/irlan/irlan_common.c
net/irda/irlan/irlan_provider.c
net/irda/irlap.c
net/irda/irlap_frame.c
net/irda/irlmp.c
net/irda/irnet/irnet_ppp.c
net/irda/irttp.c
net/lapb/lapb_iface.c
net/llc/llc_core.c
net/netlink/af_netlink.c
net/rxrpc/connection.c
net/rxrpc/peer.c
net/rxrpc/transport.c
net/sched/act_api.c
net/sched/act_pedit.c
net/sched/act_police.c
net/sched/cls_basic.c
net/sched/cls_fw.c
net/sched/cls_route.c
net/sched/cls_rsvp.h
net/sched/cls_tcindex.c
net/sched/cls_u32.c
net/sched/em_meta.c
net/sched/ematch.c
net/sched/estimator.c
net/sched/sch_cbq.c
net/sched/sch_generic.c
net/sched/sch_gred.c
net/sched/sch_hfsc.c
net/sched/sch_htb.c
net/sched/sch_netem.c
net/sctp/associola.c
net/sctp/bind_addr.c
net/sctp/endpointola.c
net/sctp/ipv6.c
net/sctp/outqueue.c
net/sctp/protocol.c
net/sctp/sm_make_chunk.c
net/sctp/sm_sideeffect.c
net/sctp/sm_statefuns.c
net/sctp/socket.c
net/sctp/transport.c
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/gss_krb5_mech.c
net/sunrpc/auth_gss/gss_mech_switch.c
net/sunrpc/auth_gss/gss_spkm3_mech.c
net/sunrpc/auth_gss/gss_spkm3_token.c
net/sunrpc/clnt.c
net/sunrpc/stats.c
net/sunrpc/svc.c
net/sunrpc/svcsock.c
net/sunrpc/xprt.c
net/sunrpc/xprtsock.c
net/tipc/bearer.c
net/tipc/cluster.c
net/tipc/discover.c
net/tipc/link.c
net/tipc/name_table.c
net/tipc/net.c
net/tipc/port.c
net/tipc/ref.c
net/tipc/subscr.c
net/tipc/user_reg.c
net/tipc/zone.c
net/unix/af_unix.c
net/wanrouter/af_wanpipe.c
net/wanrouter/wanmain.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c

index e99028ca2f7c9da7fe87ca1bc8ed8c961e183feb..b2afc7ae965bde912209daaceaff89ed6f1c7bb2 100644 (file)
@@ -1676,10 +1676,8 @@ L:       linux-kernel@vger.kernel.org
 S:     Maintained
 
 LAPB module
-P:     Henner Eisen
-M:     eis@baty.hanse.de
 L:     linux-x25@vger.kernel.org
-S:     Maintained
+S:     Orphan
 
 LASI 53c700 driver for PARISC
 P:     James E.J. Bottomley
index 17bc8abd5df50b8e9ad1c821340f333807504586..00f574cbb0d47ca0c69d8b4b0c2ed77be9e24282 100644 (file)
@@ -1174,8 +1174,12 @@ static void dcd_change(MGSLPC_INFO *info)
        else
                info->input_signal_events.dcd_down++;
 #ifdef CONFIG_HDLC
-       if (info->netcount)
-               hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, info->netdev);
+       if (info->netcount) {
+               if (info->serial_signals & SerialSignal_DCD)
+                       netif_carrier_on(info->netdev);
+               else
+                       netif_carrier_off(info->netdev);
+       }
 #endif
        wake_up_interruptible(&info->status_event_wait_q);
        wake_up_interruptible(&info->event_wait_q);
@@ -4251,8 +4255,10 @@ static int hdlcdev_open(struct net_device *dev)
        spin_lock_irqsave(&info->lock, flags);
        get_signals(info);
        spin_unlock_irqrestore(&info->lock, flags);
-       hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, dev);
-
+       if (info->serial_signals & SerialSignal_DCD)
+               netif_carrier_on(dev);
+       else
+               netif_carrier_off(dev);
        return 0;
 }
 
index df782dd1098c1b61b92fc915d18f471b07dff0ad..78b1b1a2732b3e9216556c3caa2b77354a0457d6 100644 (file)
@@ -1344,8 +1344,12 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info )
                        } else
                                info->input_signal_events.dcd_down++;
 #ifdef CONFIG_HDLC
-                       if (info->netcount)
-                               hdlc_set_carrier(status & MISCSTATUS_DCD, info->netdev);
+                       if (info->netcount) {
+                               if (status & MISCSTATUS_DCD)
+                                       netif_carrier_on(info->netdev);
+                               else
+                                       netif_carrier_off(info->netdev);
+                       }
 #endif
                }
                if (status & MISCSTATUS_CTS_LATCHED)
@@ -7844,8 +7848,10 @@ static int hdlcdev_open(struct net_device *dev)
        spin_lock_irqsave(&info->irq_spinlock, flags);
        usc_get_serial_signals(info);
        spin_unlock_irqrestore(&info->irq_spinlock, flags);
-       hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, dev);
-
+       if (info->serial_signals & SerialSignal_DCD)
+               netif_carrier_on(dev);
+       else
+               netif_carrier_off(dev);
        return 0;
 }
 
index e829594195c1d836c6dca220c74e47939a5f45ec..b2dbbdb1bf81340092aa91d8b03e2c4b54f20c6a 100644 (file)
@@ -1497,8 +1497,10 @@ static int hdlcdev_open(struct net_device *dev)
        spin_lock_irqsave(&info->lock, flags);
        get_signals(info);
        spin_unlock_irqrestore(&info->lock, flags);
-       hdlc_set_carrier(info->signals & SerialSignal_DCD, dev);
-
+       if (info->signals & SerialSignal_DCD)
+               netif_carrier_on(dev);
+       else
+               netif_carrier_off(dev);
        return 0;
 }
 
@@ -1997,8 +1999,12 @@ static void dcd_change(struct slgt_info *info)
                info->input_signal_events.dcd_down++;
        }
 #ifdef CONFIG_HDLC
-       if (info->netcount)
-               hdlc_set_carrier(info->signals & SerialSignal_DCD, info->netdev);
+       if (info->netcount) {
+               if (info->signals & SerialSignal_DCD)
+                       netif_carrier_on(info->netdev);
+               else
+                       netif_carrier_off(info->netdev);
+       }
 #endif
        wake_up_interruptible(&info->status_event_wait_q);
        wake_up_interruptible(&info->event_wait_q);
index 1e443a233f5102e3eef924ef0cb114e82b6f8f43..66f3754fbbdf443e891b21cdfcf88c799144e6b9 100644 (file)
@@ -1752,8 +1752,10 @@ static int hdlcdev_open(struct net_device *dev)
        spin_lock_irqsave(&info->lock, flags);
        get_signals(info);
        spin_unlock_irqrestore(&info->lock, flags);
-       hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, dev);
-
+       if (info->serial_signals & SerialSignal_DCD)
+               netif_carrier_on(dev);
+       else
+               netif_carrier_off(dev);
        return 0;
 }
 
@@ -2522,8 +2524,12 @@ void isr_io_pin( SLMP_INFO *info, u16 status )
                        } else
                                info->input_signal_events.dcd_down++;
 #ifdef CONFIG_HDLC
-                       if (info->netcount)
-                               hdlc_set_carrier(status & SerialSignal_DCD, info->netdev);
+                       if (info->netcount) {
+                               if (status & SerialSignal_DCD)
+                                       netif_carrier_on(info->netdev);
+                               else
+                                       netif_carrier_off(info->netdev);
+                       }
 #endif
                }
                if (status & MISCSTATUS_CTS_LATCHED)
index 78bf46d917b70eec62feab544ca6b839e482f978..dbd4d6c3698e7761849dee0cb019ac7f3366c486 100644 (file)
@@ -828,7 +828,7 @@ static int __init ioat_init_module(void)
        /* if forced, worst case is that rmmod hangs */
        __unsafe(THIS_MODULE);
 
-       return pci_module_init(&ioat_pci_drv);
+       return pci_register_driver(&ioat_pci_drv);
 }
 
 module_init(ioat_init_module);
index 36d511729f7116549bdf560ee1df3c149f4b737c..2146cf74425ef239f678f484ba37a6ecc272f44c 100644 (file)
@@ -132,6 +132,7 @@ static int __init dummy_init_module(void)
        for (i = 0; i < numdummies && !err; i++)
                err = dummy_init_one(i); 
        if (err) { 
+               i--;
                while (--i >= 0)
                        dummy_free_one(i);
        }
index 3a42afab50362983fc2b393b191757d59f5d5c21..43e3f33ed5e20578b57b6872bf1be549a3502fbf 100644 (file)
@@ -271,6 +271,7 @@ static int __init ifb_init_module(void)
        for (i = 0; i < numifbs && !err; i++)
                err = ifb_init_one(i); 
        if (err) { 
+               i--;
                while (--i >= 0)
                        ifb_free_one(i);
        }
index 8673fd4c08c7bfe76e5027a078d949a472fd0c78..c6f5bc3c042ffde958ba2841f1730d92ae325f82 100644 (file)
@@ -3255,12 +3255,7 @@ static void __devexit happy_meal_pci_remove(struct pci_dev *pdev)
 }
 
 static struct pci_device_id happymeal_pci_ids[] = {
-       {
-         .vendor       = PCI_VENDOR_ID_SUN,
-         .device       = PCI_DEVICE_ID_SUN_HAPPYMEAL,
-         .subvendor    = PCI_ANY_ID,
-         .subdevice    = PCI_ANY_ID,
-       },
+       { PCI_DEVICE(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_HAPPYMEAL) },
        { }                     /* Terminating entry */
 };
 
@@ -3275,7 +3270,7 @@ static struct pci_driver hme_pci_driver = {
 
 static int __init happy_meal_pci_init(void)
 {
-       return pci_module_init(&hme_pci_driver);
+       return pci_register_driver(&hme_pci_driver);
 }
 
 static void happy_meal_pci_exit(void)
index 2c09ec908a3fa94390df7db514cd9fa05a0ef593..435e91ec4620735d4015b870fa96e1e23a5fabdd 100644 (file)
@@ -197,7 +197,6 @@ static int c101_open(struct net_device *dev)
        sca_out(IE0_TXINT, MSCI0_OFFSET + IE0, port);
 
        set_carrier(port);
-       printk(KERN_DEBUG "0x%X\n", sca_in(MSCI1_OFFSET + ST3, port));
 
        /* enable MSCI1 CDCD interrupt */
        sca_out(IE1_CDCD, MSCI1_OFFSET + IE1, port);
@@ -449,4 +448,5 @@ module_exit(c101_cleanup);
 MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
 MODULE_DESCRIPTION("Moxa C101 serial port driver");
 MODULE_LICENSE("GPL v2");
-module_param(hw, charp, 0444); /* hw=irq,ram:irq,... */
+module_param(hw, charp, 0444);
+MODULE_PARM_DESC(hw, "irq,ram:irq,...");
index b81263eaede07c0be93f732b21f60289041ec081..fbaab5bf71eb55b50ad8acc303dbad412d2776d9 100644 (file)
@@ -107,6 +107,7 @@ int hdlc_ppp_ioctl(struct net_device *dev, struct ifreq *ifr)
                dev->hard_header = NULL;
                dev->type = ARPHRD_PPP;
                dev->addr_len = 0;
+               netif_dormant_off(dev);
                return 0;
        }
 
index 9456d31cb1c148150e41ecbe1b87837f2df19672..f15aa6ba77f1ee8450fd6dabb35add9d637ef94a 100644 (file)
@@ -82,6 +82,7 @@ int hdlc_raw_ioctl(struct net_device *dev, struct ifreq *ifr)
                dev->type = ARPHRD_RAWHDLC;
                dev->flags = IFF_POINTOPOINT | IFF_NOARP;
                dev->addr_len = 0;
+               netif_dormant_off(dev);
                return 0;
        }
 
index b1285cc8fee6cf8d91d337ec30cd722dcde0c852..d1884987f94e08efbf06cc41ec68785b29a6a332 100644 (file)
@@ -100,6 +100,7 @@ int hdlc_raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr)
                dev->tx_queue_len = old_qlen;
                memcpy(dev->dev_addr, "\x00\x01", 2);
                 get_random_bytes(dev->dev_addr + 2, ETH_ALEN - 2);
+               netif_dormant_off(dev);
                return 0;
        }
 
index 07e5eef1fe0f4e3b009e6fa64f1b52f5553bc3c7..a867fb411f89b90d1219e2a05801b6b6ad8a9419 100644 (file)
@@ -212,6 +212,7 @@ int hdlc_x25_ioctl(struct net_device *dev, struct ifreq *ifr)
                dev->hard_header = NULL;
                dev->type = ARPHRD_X25;
                dev->addr_len = 0;
+               netif_dormant_off(dev);
                return 0;
        }
 
index e013b817cab8dbb22fd1df3f426b45d3d260e223..dcf46add3adfece0ce13b4d57173dddcabca9316 100644 (file)
@@ -564,4 +564,5 @@ module_exit(n2_cleanup);
 MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
 MODULE_DESCRIPTION("RISCom/N2 serial port driver");
 MODULE_LICENSE("GPL v2");
-module_param(hw, charp, 0444); /* hw=io,irq,ram,ports:io,irq,... */
+module_param(hw, charp, 0444);
+MODULE_PARM_DESC(hw, "io,irq,ram,ports:io,irq,...");
index 76cc099c8580fa06551f98f0ec2635f2c2a85496..75f02d8c6ed376b192858faff4de312c3b71e2ab 100644 (file)
@@ -924,10 +924,10 @@ static inline void netif_tx_lock_bh(struct net_device *dev)
 
 static inline int netif_tx_trylock(struct net_device *dev)
 {
-       int err = spin_trylock(&dev->_xmit_lock);
-       if (!err)
+       int ok = spin_trylock(&dev->_xmit_lock);
+       if (likely(ok))
                dev->xmit_lock_owner = smp_processor_id();
-       return err;
+       return ok;
 }
 
 static inline void netif_tx_unlock(struct net_device *dev)
index 19760eb131aabefecc043ee5e50d224221ff504f..ceae5ee85c0490178041aa9705944094e6e188cb 100644 (file)
@@ -37,7 +37,7 @@ static inline struct dma_chan *get_softnet_dma(void)
 }
 
 int dma_skb_copy_datagram_iovec(struct dma_chan* chan,
-               const struct sk_buff *skb, int offset, struct iovec *to,
+               struct sk_buff *skb, int offset, struct iovec *to,
                size_t len, struct dma_pinned_list *pinned_list);
 
 #endif /* CONFIG_NET_DMA */
index 5f69158c1006b3b44cdb9e58921b28c0f33a1d13..e5aa7ff1f5b5cd5a13678b02a0da833ceed4ce0f 100644 (file)
@@ -445,6 +445,7 @@ typedef struct sctp_sender_hb_info {
        struct sctp_paramhdr param_hdr;
        union sctp_addr daddr;
        unsigned long sent_at;
+       __u64 hb_nonce;
 } __attribute__((packed)) sctp_sender_hb_info_t;
 
 /*
@@ -730,13 +731,10 @@ void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,
 const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);
 
 /* This is a structure for holding either an IPv6 or an IPv4 address.  */
-/* sin_family -- AF_INET or AF_INET6
- * sin_port -- ordinary port number
- * sin_addr -- cast to either (struct in_addr) or (struct in6_addr)
- */
 struct sctp_sockaddr_entry {
        struct list_head list;
        union sctp_addr a;
+       __u8 use_as_src;
 };
 
 typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *);
@@ -984,6 +982,9 @@ struct sctp_transport {
                 */
                char cacc_saw_newack;
        } cacc;
+
+       /* 64-bit random number sent with heartbeat. */
+       __u64 hb_nonce;
 };
 
 struct sctp_transport *sctp_transport_new(const union sctp_addr *,
@@ -1138,7 +1139,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
                        sctp_scope_t scope, gfp_t gfp,
                        int flags);
 int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
-                      gfp_t gfp);
+                      __u8 use_as_src, gfp_t gfp);
 int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
 int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
                         struct sctp_sock *);
index 8a6bef6f91ebc39192805530255c6a6f94a63bc1..1b7aae6cdd82d7a4f035362655c765cec6a35f63 100644 (file)
@@ -560,9 +560,18 @@ struct sctp_paddrinfo {
 } __attribute__((packed, aligned(4)));
 
 /* Peer addresses's state. */
+/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
+ * calls.
+ * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
+ *              Not yet confirmed by a heartbeat and not available for data
+ *             transfers.
+ * ACTIVE : Peer address confirmed, active and available for data transfers.
+ * INACTIVE: Peer address inactive and not available for data transfers.
+ */
 enum sctp_spinfo_state {
        SCTP_INACTIVE,
        SCTP_ACTIVE,
+       SCTP_UNCONFIRMED,
        SCTP_UNKNOWN = 0xffff  /* Value used for transport state unknown */
 };
 
index 458031bfff558188f6820c5b02aa4fb46308899b..0ade0c63fdf6f8b49cd0af36ce4f0aa05323fbee 100644 (file)
@@ -542,12 +542,11 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
         * so it cannot "appear" on us.
         */
        if (!grp) { /* need to add a new group */
-               grp = kmalloc(sizeof(struct vlan_group), GFP_KERNEL);
+               grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL);
                if (!grp)
                        goto out_free_unregister;
                                        
                /* printk(KERN_ALERT "VLAN REGISTER:  Allocated new group.\n"); */
-               memset(grp, 0, sizeof(struct vlan_group));
                grp->real_dev_ifindex = real_dev->ifindex;
 
                hlist_add_head_rcu(&grp->hlist, 
index 5ee96d4b40e9bef72712c3e0a1f114d67ab07481..96dc6bb52d14aecd00cff0e8f37bed950d6b557f 100644 (file)
@@ -227,12 +227,11 @@ static void atif_drop_device(struct net_device *dev)
 static struct atalk_iface *atif_add_device(struct net_device *dev,
                                           struct atalk_addr *sa)
 {
-       struct atalk_iface *iface = kmalloc(sizeof(*iface), GFP_KERNEL);
+       struct atalk_iface *iface = kzalloc(sizeof(*iface), GFP_KERNEL);
 
        if (!iface)
                goto out;
 
-       memset(iface, 0, sizeof(*iface));
        dev_hold(dev);
        iface->dev = dev;
        dev->atalk_ptr = iface;
@@ -559,12 +558,11 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint)
        }
 
        if (!rt) {
-               rt = kmalloc(sizeof(*rt), GFP_ATOMIC);
+               rt = kzalloc(sizeof(*rt), GFP_ATOMIC);
 
                retval = -ENOBUFS;
                if (!rt)
                        goto out_unlock;
-               memset(rt, 0, sizeof(*rt));
 
                rt->next = atalk_routes;
                atalk_routes = rt;
index a487233dc466f35e4b5964394b5f4d61da7fd9ce..d00cca97eb33bea4895be72c88abea6ca4293a7e 100644 (file)
@@ -508,10 +508,9 @@ Note: we do not have explicit unassign, but look at _push()
 
        if (copy_from_user(&be, arg, sizeof be))
                return -EFAULT;
-       brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
+       brvcc = kzalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
        if (!brvcc)
                return -ENOMEM;
-       memset(brvcc, 0, sizeof(struct br2684_vcc));
        write_lock_irq(&devs_lock);
        net_dev = br2684_find_dev(&be.ifspec);
        if (net_dev == NULL) {
index 2e62105d91bdc48c6578cdd55280f8a8bb318665..7ce7bfe3fbad3a3908b5a551b3bc8ea37acd9c22 100644 (file)
@@ -929,12 +929,11 @@ static int arp_seq_open(struct inode *inode, struct file *file)
        struct seq_file *seq;
        int rc = -EAGAIN;
 
-       state = kmalloc(sizeof(*state), GFP_KERNEL);
+       state = kzalloc(sizeof(*state), GFP_KERNEL);
        if (!state) {
                rc = -ENOMEM;
                goto out_kfree;
        }
-       memset(state, 0, sizeof(*state));
        state->ns.neigh_sub_iter = clip_seq_sub_iter;
 
        rc = seq_open(file, &arp_seq_ops);
index 4b68a18171cf4f0a8ae402cb6e0526bf7f05f383..b4aa489849dfefc0185395415de8e88c31b303ab 100644 (file)
@@ -1811,12 +1811,11 @@ make_entry(struct lec_priv *priv, unsigned char *mac_addr)
 {
         struct lec_arp_table *to_return;
 
-        to_return = kmalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
+        to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
         if (!to_return) {
                 printk("LEC: Arp entry kmalloc failed\n");
                 return NULL;
         }
-        memset(to_return, 0, sizeof(struct lec_arp_table));
         memcpy(to_return->mac_addr, mac_addr, ETH_ALEN);
         init_timer(&to_return->timer);
         to_return->timer.function = lec_arp_expire_arp;
index 9aafe1e2f04802a2398f51168cbcc4c4d53d300f..00704661e83f684872796f25d96f4b1c6501f56e 100644 (file)
@@ -258,10 +258,9 @@ static struct mpoa_client *alloc_mpc(void)
 {
        struct mpoa_client *mpc;
 
-       mpc = kmalloc(sizeof (struct mpoa_client), GFP_KERNEL);
+       mpc = kzalloc(sizeof (struct mpoa_client), GFP_KERNEL);
        if (mpc == NULL)
                return NULL;
-       memset(mpc, 0, sizeof(struct mpoa_client));
        rwlock_init(&mpc->ingress_lock);
        rwlock_init(&mpc->egress_lock);
        mpc->next = mpcs;
index 76a7d8ff6c0e79f5ed940b76a514f1a53af464eb..19d5dfc0702f2477447e4f228801e64794d7e68f 100644 (file)
@@ -287,10 +287,9 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg)
        if (be.encaps != PPPOATM_ENCAPS_AUTODETECT &&
            be.encaps != PPPOATM_ENCAPS_VC && be.encaps != PPPOATM_ENCAPS_LLC)
                return -EINVAL;
-       pvcc = kmalloc(sizeof(*pvcc), GFP_KERNEL);
+       pvcc = kzalloc(sizeof(*pvcc), GFP_KERNEL);
        if (pvcc == NULL)
                return -ENOMEM;
-       memset(pvcc, 0, sizeof(*pvcc));
        pvcc->atmvcc = atmvcc;
        pvcc->old_push = atmvcc->push;
        pvcc->old_pop = atmvcc->pop;
index de25c6408b04024e0f5f7f85b8c22564839e148b..529f7e64aa2c33ae45d162b035ccf241431c6c0d 100644 (file)
@@ -33,10 +33,9 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
 {
        struct atm_dev *dev;
 
-       dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (!dev)
                return NULL;
-       memset(dev, 0, sizeof(*dev));
        dev->type = type;
        dev->signal = ATM_PHY_SIG_UNKNOWN;
        dev->link_rate = ATM_OC3_PCR;
index 369a75b160f2d688a898fe43a1b2f7203658bbd1..867d42537979d6c320c17aefa514c378f2f8fcc2 100644 (file)
@@ -203,13 +203,11 @@ void ax25_register_sysctl(void)
        for (ax25_table_size = sizeof(ctl_table), ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next)
                ax25_table_size += sizeof(ctl_table);
 
-       if ((ax25_table = kmalloc(ax25_table_size, GFP_ATOMIC)) == NULL) {
+       if ((ax25_table = kzalloc(ax25_table_size, GFP_ATOMIC)) == NULL) {
                spin_unlock_bh(&ax25_dev_lock);
                return;
        }
 
-       memset(ax25_table, 0x00, ax25_table_size);
-
        for (n = 0, ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next) {
                ctl_table *child = kmalloc(sizeof(ax25_param_table), GFP_ATOMIC);
                if (!child) {
index 159fb84098241fdcc0a3a597d2d476cf80d78421..4e4119a1213925568b8a1acdef9bf52b98b19da3 100644 (file)
@@ -162,12 +162,10 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                if (num > BR_MAX_PORTS)
                        num = BR_MAX_PORTS;
 
-               indices = kmalloc(num*sizeof(int), GFP_KERNEL);
+               indices = kcalloc(num, sizeof(int), GFP_KERNEL);
                if (indices == NULL)
                        return -ENOMEM;
 
-               memset(indices, 0, num*sizeof(int));
-
                get_port_ifindices(br, indices, num);
                if (copy_to_user((void __user *)args[1], indices, num*sizeof(int)))
                        num =  -EFAULT;
@@ -327,11 +325,10 @@ static int old_deviceless(void __user *uarg)
 
                if (args[2] >= 2048)
                        return -ENOMEM;
-               indices = kmalloc(args[2]*sizeof(int), GFP_KERNEL);
+               indices = kcalloc(args[2], sizeof(int), GFP_KERNEL);
                if (indices == NULL)
                        return -ENOMEM;
 
-               memset(indices, 0, args[2]*sizeof(int));
                args[2] = get_bridge_ifindices(indices, args[2]);
 
                ret = copy_to_user((void __user *)args[1], indices, args[2]*sizeof(int))
index b7c98dbcdb81102ccd50e0d3f354294eae6c6919..248a6b666aff396233020e46ea56a9d2d14d8885 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/socket.h>
 #include <linux/rtnetlink.h> /* for BUG_TRAP */
 #include <net/tcp.h>
+#include <net/netdma.h>
 
 #define NET_DMA_DEFAULT_COPYBREAK 4096
 
index 98a25208440dcb39bcd181af751a91b3d5ab2ee6..476455fbdb03058a67c0a6223738693df2fed373 100644 (file)
@@ -413,11 +413,7 @@ static struct dn_ifaddr *dn_dev_alloc_ifa(void)
 {
        struct dn_ifaddr *ifa;
 
-       ifa = kmalloc(sizeof(*ifa), GFP_KERNEL);
-
-       if (ifa) {
-               memset(ifa, 0, sizeof(*ifa));
-       }
+       ifa = kzalloc(sizeof(*ifa), GFP_KERNEL);
 
        return ifa;
 }
@@ -1105,10 +1101,9 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
                return NULL;
 
        *err = -ENOBUFS;
-       if ((dn_db = kmalloc(sizeof(struct dn_dev), GFP_ATOMIC)) == NULL)
+       if ((dn_db = kzalloc(sizeof(struct dn_dev), GFP_ATOMIC)) == NULL)
                return NULL;
 
-       memset(dn_db, 0, sizeof(struct dn_dev));
        memcpy(&dn_db->parms, p, sizeof(struct dn_dev_parms));
        smp_wmb();
        dev->dn_ptr = dn_db;
index 0375077391b7a39111e839dba86b6b5e4d48dbf5..fa20e2efcfc1b76aa86697c16b66871edf382706 100644 (file)
@@ -283,11 +283,10 @@ struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, struct dn_kern_rta
                        goto err_inval;
        }
 
-       fi = kmalloc(sizeof(*fi)+nhs*sizeof(struct dn_fib_nh), GFP_KERNEL);
+       fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct dn_fib_nh), GFP_KERNEL);
        err = -ENOBUFS;
        if (fi == NULL)
                goto failure;
-       memset(fi, 0, sizeof(*fi)+nhs*sizeof(struct dn_fib_nh));
 
        fi->fib_protocol = r->rtm_protocol;
        fi->fib_nhs = nhs;
index 5ce9c9e0565c1448e5e71333b36c3e464cc895a2..ff0ebe99137de244092c92e87d0dda7e9fc8ed57 100644 (file)
@@ -580,12 +580,11 @@ static int dn_neigh_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct neigh_seq_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
 
        if (!s)
                goto out;
 
-       memset(s, 0, sizeof(*s));
        rc = seq_open(file, &dn_neigh_seq_ops);
        if (rc)
                goto out_kfree;
index 22f321d9bf9d233474aa6a2a0d36c7388b0f1387..6986be754ef284cb0f023e3d08c3c4321ad31af9 100644 (file)
@@ -151,10 +151,9 @@ int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
                }
        }
 
-       new_r = kmalloc(sizeof(*new_r), GFP_KERNEL);
+       new_r = kzalloc(sizeof(*new_r), GFP_KERNEL);
        if (!new_r)
                return -ENOMEM;
-       memset(new_r, 0, sizeof(*new_r));
 
        if (rta[RTA_SRC-1])
                memcpy(&new_r->r_src, RTA_DATA(rta[RTA_SRC-1]), 2);
index 37d9d0a1ac8ce73d0f92141e92392d53df5934fc..e926c952e3632617812e1c1d3eec192cfe2dfeda 100644 (file)
@@ -158,12 +158,10 @@ static void dn_rehash_zone(struct dn_zone *dz)
                        break;
        }
 
-       ht = kmalloc(new_divisor*sizeof(struct dn_fib_node*), GFP_KERNEL);
-
+       ht = kcalloc(new_divisor, sizeof(struct dn_fib_node*), GFP_KERNEL);
        if (ht == NULL)
                return;
 
-       memset(ht, 0, new_divisor*sizeof(struct dn_fib_node *));
        write_lock_bh(&dn_fib_tables_lock);
        old_ht = dz->dz_hash;
        dz->dz_hash = ht;
@@ -184,11 +182,10 @@ static void dn_free_node(struct dn_fib_node *f)
 static struct dn_zone *dn_new_zone(struct dn_hash *table, int z)
 {
        int i;
-       struct dn_zone *dz = kmalloc(sizeof(struct dn_zone), GFP_KERNEL);
+       struct dn_zone *dz = kzalloc(sizeof(struct dn_zone), GFP_KERNEL);
        if (!dz)
                return NULL;
 
-       memset(dz, 0, sizeof(struct dn_zone));
        if (z) {
                dz->dz_divisor = 16;
                dz->dz_hashmask = 0x0F;
@@ -197,14 +194,12 @@ static struct dn_zone *dn_new_zone(struct dn_hash *table, int z)
                dz->dz_hashmask = 0;
        }
 
-       dz->dz_hash = kmalloc(dz->dz_divisor*sizeof(struct dn_fib_node *), GFP_KERNEL);
-
+       dz->dz_hash = kcalloc(dz->dz_divisor, sizeof(struct dn_fib_node *), GFP_KERNEL);
        if (!dz->dz_hash) {
                kfree(dz);
                return NULL;
        }
 
-       memset(dz->dz_hash, 0, dz->dz_divisor*sizeof(struct dn_fib_node*));
        dz->dz_order = z;
        dz->dz_mask = dnet_make_mask(z);
 
index 309ae4c6549a9d3b12c28222a548a582b79d88b5..4d66aac134835fb082044c26041c6f6039e3ba24 100644 (file)
@@ -673,12 +673,11 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg)
                edev = dev->ec_ptr;
                if (edev == NULL) {
                        /* Magic up a new one. */
-                       edev = kmalloc(sizeof(struct ec_device), GFP_KERNEL);
+                       edev = kzalloc(sizeof(struct ec_device), GFP_KERNEL);
                        if (edev == NULL) {
                                err = -ENOMEM;
                                break;
                        }
-                       memset(edev, 0, sizeof(struct ec_device));
                        dev->ec_ptr = edev;
                } else
                        net2dev_map[edev->net] = NULL;
index cb71d794a7d1711af7289417738a823de830d6f9..5ed0a98b2d7680ae2d3a8b169a4e5664842b0444 100644 (file)
@@ -110,11 +110,10 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
        unsigned long flags;
        struct ieee80211_crypto_alg *alg;
 
-       alg = kmalloc(sizeof(*alg), GFP_KERNEL);
+       alg = kzalloc(sizeof(*alg), GFP_KERNEL);
        if (alg == NULL)
                return -ENOMEM;
 
-       memset(alg, 0, sizeof(*alg));
        alg->ops = ops;
 
        spin_lock_irqsave(&ieee80211_crypto_lock, flags);
index 492647382ad04caee03a90121fcc52012fb4e6ba..ed90a8af1444937c5d9cfc066321f8d7311d2564 100644 (file)
@@ -76,10 +76,9 @@ static void *ieee80211_ccmp_init(int key_idx)
 {
        struct ieee80211_ccmp_data *priv;
 
-       priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
+       priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
        if (priv == NULL)
                goto fail;
-       memset(priv, 0, sizeof(*priv));
        priv->key_idx = key_idx;
 
        priv->tfm = crypto_alloc_tfm("aes", 0);
index c5a87724aabeaf5f16e74bdc66ace2098d68b857..0ebf235f693932e4c09241b7402658bd14d6620a 100644 (file)
@@ -39,10 +39,9 @@ static void *prism2_wep_init(int keyidx)
 {
        struct prism2_wep_data *priv;
 
-       priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
+       priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
        if (priv == NULL)
                goto fail;
-       memset(priv, 0, sizeof(*priv));
        priv->key_idx = keyidx;
 
        priv->tfm = crypto_alloc_tfm("arc4", 0);
index a78c4f845f66a88f3a2f95fb59adc8790c6af723..5cb9cfd35397dadc60c66a0048945ec88a57d8a0 100644 (file)
@@ -369,11 +369,10 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
                struct ieee80211_crypt_data *new_crypt;
 
                /* take WEP into use */
-               new_crypt = kmalloc(sizeof(struct ieee80211_crypt_data),
+               new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
                                    GFP_KERNEL);
                if (new_crypt == NULL)
                        return -ENOMEM;
-               memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
                new_crypt->ops = ieee80211_get_crypto_ops("WEP");
                if (!new_crypt->ops) {
                        request_module("ieee80211_crypt_wep");
@@ -616,13 +615,11 @@ int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee,
 
                ieee80211_crypt_delayed_deinit(ieee, crypt);
 
-               new_crypt = (struct ieee80211_crypt_data *)
-                   kmalloc(sizeof(*new_crypt), GFP_KERNEL);
+               new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
                if (new_crypt == NULL) {
                        ret = -ENOMEM;
                        goto done;
                }
-               memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
                new_crypt->ops = ops;
                if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
                        new_crypt->priv = new_crypt->ops->init(idx);
index 8cc8b20f5cda3529b7302141e0d7e48d751561fe..6ae5a1dc79564742f1bfd024ae9e2b37058fb4c0 100644 (file)
@@ -96,8 +96,7 @@ ieee80211softmac_alloc_mgt(u32 size)
        if(size > IEEE80211_DATA_LEN)
                return NULL;
        /* Allocate the frame */
-       data = kmalloc(size, GFP_ATOMIC);
-       memset(data, 0, size);
+       data = kzalloc(size, GFP_ATOMIC);
        return data;
 }
 
index 8e748be36c5a5bf05c317e686f5fb8781ea8a20b..1366bc6ce6a5cfc968d5a45a930e3742dbb6fb53 100644 (file)
@@ -215,12 +215,10 @@ static int ah_init_state(struct xfrm_state *x)
        if (x->encap)
                goto error;
 
-       ahp = kmalloc(sizeof(*ahp), GFP_KERNEL);
+       ahp = kzalloc(sizeof(*ahp), GFP_KERNEL);
        if (ahp == NULL)
                return -ENOMEM;
 
-       memset(ahp, 0, sizeof(*ahp));
-
        ahp->key = x->aalg->alg_key;
        ahp->key_len = (x->aalg->alg_key_len+7)/8;
        ahp->tfm = crypto_alloc_tfm(x->aalg->alg_name, 0);
index 7b51b3bdb548060b7c5ad42851c530a8321782c8..c8a3723bc001b0a744d382a4a353c2c902a28ddd 100644 (file)
@@ -1372,12 +1372,11 @@ static int arp_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct neigh_seq_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
        
        if (!s)
                goto out;
 
-       memset(s, 0, sizeof(*s));
        rc = seq_open(file, &arp_seq_ops);
        if (rc)
                goto out_kfree;
index a7c65e9e5ec9d9b463140b0463e2b1d2511723fc..a6cc31d911ebfc6d3504a7dc1bd8a555245580f3 100644 (file)
@@ -93,10 +93,9 @@ static void devinet_sysctl_unregister(struct ipv4_devconf *p);
 
 static struct in_ifaddr *inet_alloc_ifa(void)
 {
-       struct in_ifaddr *ifa = kmalloc(sizeof(*ifa), GFP_KERNEL);
+       struct in_ifaddr *ifa = kzalloc(sizeof(*ifa), GFP_KERNEL);
 
        if (ifa) {
-               memset(ifa, 0, sizeof(*ifa));
                INIT_RCU_HEAD(&ifa->rcu_head);
        }
 
@@ -140,10 +139,9 @@ struct in_device *inetdev_init(struct net_device *dev)
 
        ASSERT_RTNL();
 
-       in_dev = kmalloc(sizeof(*in_dev), GFP_KERNEL);
+       in_dev = kzalloc(sizeof(*in_dev), GFP_KERNEL);
        if (!in_dev)
                goto out;
-       memset(in_dev, 0, sizeof(*in_dev));
        INIT_RCU_HEAD(&in_dev->rcu_head);
        memcpy(&in_dev->cnf, &ipv4_devconf_dflt, sizeof(in_dev->cnf));
        in_dev->cnf.sysctl = NULL;
index 4e112738b3fa15d789944b139a91eb131b12b17e..fc2f8ce441def709bb1fdc88a4e8c651fc29ede2 100644 (file)
@@ -316,12 +316,10 @@ static int esp_init_state(struct xfrm_state *x)
        if (x->ealg == NULL)
                goto error;
 
-       esp = kmalloc(sizeof(*esp), GFP_KERNEL);
+       esp = kzalloc(sizeof(*esp), GFP_KERNEL);
        if (esp == NULL)
                return -ENOMEM;
 
-       memset(esp, 0, sizeof(*esp));
-
        if (x->aalg) {
                struct xfrm_algo_desc *aalg_desc;
 
index 3c1d32ad35f2e0ec74ee06e94698a2911abfb95a..72c633b357cf3bd53592ebb88f4ddeae3560868e 100644 (file)
@@ -204,11 +204,10 @@ static struct fn_zone *
 fn_new_zone(struct fn_hash *table, int z)
 {
        int i;
-       struct fn_zone *fz = kmalloc(sizeof(struct fn_zone), GFP_KERNEL);
+       struct fn_zone *fz = kzalloc(sizeof(struct fn_zone), GFP_KERNEL);
        if (!fz)
                return NULL;
 
-       memset(fz, 0, sizeof(struct fn_zone));
        if (z) {
                fz->fz_divisor = 16;
        } else {
@@ -1046,7 +1045,7 @@ static int fib_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct fib_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct fib_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
        
        if (!s)
                goto out;
@@ -1057,7 +1056,6 @@ static int fib_seq_open(struct inode *inode, struct file *file)
 
        seq          = file->private_data;
        seq->private = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
index 773b12ba4e3cf965634df3ad4bf9fb34a8e74433..79b04718bdfdd567c1d6a337627a292eb975e8eb 100644 (file)
@@ -196,10 +196,9 @@ int inet_rtm_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
                }
        }
 
-       new_r = kmalloc(sizeof(*new_r), GFP_KERNEL);
+       new_r = kzalloc(sizeof(*new_r), GFP_KERNEL);
        if (!new_r)
                return -ENOMEM;
-       memset(new_r, 0, sizeof(*new_r));
 
        if (rta[RTA_SRC-1])
                memcpy(&new_r->r_src, RTA_DATA(rta[RTA_SRC-1]), 4);
index 5f87533684d5ab5b156fc02825097f200160e764..9be53a8e72c338d7865dadcc747d6003cd1c8b20 100644 (file)
@@ -709,11 +709,10 @@ fib_create_info(const struct rtmsg *r, struct kern_rta *rta,
                        goto failure;
        }
 
-       fi = kmalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL);
+       fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL);
        if (fi == NULL)
                goto failure;
        fib_info_cnt++;
-       memset(fi, 0, sizeof(*fi)+nhs*sizeof(struct fib_nh));
 
        fi->fib_protocol = r->rtm_protocol;
 
@@ -962,10 +961,6 @@ fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
        rtm->rtm_protocol = fi->fib_protocol;
        if (fi->fib_priority)
                RTA_PUT(skb, RTA_PRIORITY, 4, &fi->fib_priority);
-#ifdef CONFIG_NET_CLS_ROUTE
-       if (fi->fib_nh[0].nh_tclassid)
-               RTA_PUT(skb, RTA_FLOW, 4, &fi->fib_nh[0].nh_tclassid);
-#endif
        if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0)
                goto rtattr_failure;
        if (fi->fib_prefsrc)
@@ -975,6 +970,10 @@ fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
                        RTA_PUT(skb, RTA_GATEWAY, 4, &fi->fib_nh->nh_gw);
                if (fi->fib_nh->nh_oif)
                        RTA_PUT(skb, RTA_OIF, sizeof(int), &fi->fib_nh->nh_oif);
+#ifdef CONFIG_NET_CLS_ROUTE
+               if (fi->fib_nh[0].nh_tclassid)
+                       RTA_PUT(skb, RTA_FLOW, 4, &fi->fib_nh[0].nh_tclassid);
+#endif
        }
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
        if (fi->fib_nhs > 1) {
@@ -993,6 +992,10 @@ fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
                        nhp->rtnh_ifindex = nh->nh_oif;
                        if (nh->nh_gw)
                                RTA_PUT(skb, RTA_GATEWAY, 4, &nh->nh_gw);
+#ifdef CONFIG_NET_CLS_ROUTE
+                       if (nh->nh_tclassid)
+                               RTA_PUT(skb, RTA_FLOW, 4, &nh->nh_tclassid);
+#endif
                        nhp->rtnh_len = skb->tail - (unsigned char*)nhp;
                } endfor_nexthops(fi);
                mp_head->rta_type = RTA_MULTIPATH;
index d299c8e547d6fc12bef77b60ceeaaed19c282715..9f4b752f5a337e7dfae09970d5112dc4bc6dc54b 100644 (file)
@@ -1028,10 +1028,9 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im)
         * for deleted items allows change reports to use common code with
         * non-deleted or query-response MCA's.
         */
-       pmc = kmalloc(sizeof(*pmc), GFP_KERNEL);
+       pmc = kzalloc(sizeof(*pmc), GFP_KERNEL);
        if (!pmc)
                return;
-       memset(pmc, 0, sizeof(*pmc));
        spin_lock_bh(&im->lock);
        pmc->interface = im->interface;
        in_dev_hold(in_dev);
@@ -1529,10 +1528,9 @@ static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode,
                psf_prev = psf;
        }
        if (!psf) {
-               psf = kmalloc(sizeof(*psf), GFP_ATOMIC);
+               psf = kzalloc(sizeof(*psf), GFP_ATOMIC);
                if (!psf)
                        return -ENOBUFS;
-               memset(psf, 0, sizeof(*psf));
                psf->sf_inaddr = *psfsrc;
                if (psf_prev) {
                        psf_prev->sf_next = psf;
@@ -2380,7 +2378,7 @@ static int igmp_mc_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct igmp_mc_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct igmp_mc_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
 
        if (!s)
                goto out;
@@ -2390,7 +2388,6 @@ static int igmp_mc_seq_open(struct inode *inode, struct file *file)
 
        seq = file->private_data;
        seq->private = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
@@ -2555,7 +2552,7 @@ static int igmp_mcf_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct igmp_mcf_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct igmp_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
 
        if (!s)
                goto out;
@@ -2565,7 +2562,6 @@ static int igmp_mcf_seq_open(struct inode *inode, struct file *file)
 
        seq = file->private_data;
        seq->private = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
index 8e7e41b66c799177f9b9d05691936e9beb83a08f..492858e6faf0140fee625d8f966093c57c141773 100644 (file)
@@ -909,11 +909,10 @@ static int __init inet_diag_init(void)
                                          sizeof(struct inet_diag_handler *));
        int err = -ENOMEM;
 
-       inet_diag_table = kmalloc(inet_diag_table_size, GFP_KERNEL);
+       inet_diag_table = kzalloc(inet_diag_table_size, GFP_KERNEL);
        if (!inet_diag_table)
                goto out;
 
-       memset(inet_diag_table, 0, inet_diag_table_size);
        idiagnl = netlink_kernel_create(NETLINK_INET_DIAG, 0, inet_diag_rcv,
                                        THIS_MODULE);
        if (idiagnl == NULL)
index 6ff9b10d9563c9ef972fb70e06fd88e521b323f9..0f9b3a31997be8af4360f55ec77fa99f7da3f69f 100644 (file)
@@ -617,7 +617,6 @@ static int ipgre_rcv(struct sk_buff *skb)
                skb->mac.raw = skb->nh.raw;
                skb->nh.raw = __pskb_pull(skb, offset);
                skb_postpull_rcsum(skb, skb->h.raw, offset);
-               memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
                skb->pkt_type = PACKET_HOST;
 #ifdef CONFIG_NET_IPGRE_BROADCAST
                if (MULTICAST(iph->daddr)) {
index cbcae6544622932cbb7f0a57d648338bd699ceb9..406056edc02ba94f529ad6befb2c0fb934c53099 100644 (file)
@@ -256,7 +256,6 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
 
        if (!opt) {
                opt = &(IPCB(skb)->opt);
-               memset(opt, 0, sizeof(struct ip_options));
                iph = skb->nh.raw;
                opt->optlen = ((struct iphdr *)iph)->ihl*4 - sizeof(struct iphdr);
                optptr = iph + sizeof(struct iphdr);
index 8a8b5cf2f7fe68c805cec0de2ac2c23e5d944898..a0c28b2b756e0c1e8dab144eba3440f3c67d60fe 100644 (file)
@@ -410,11 +410,10 @@ static int ipcomp_init_state(struct xfrm_state *x)
                goto out;
 
        err = -ENOMEM;
-       ipcd = kmalloc(sizeof(*ipcd), GFP_KERNEL);
+       ipcd = kzalloc(sizeof(*ipcd), GFP_KERNEL);
        if (!ipcd)
                goto out;
 
-       memset(ipcd, 0, sizeof(*ipcd));
        x->props.header_len = 0;
        if (x->props.mode)
                x->props.header_len += sizeof(struct iphdr);
index 3291d5192aad93fe59c2baf911f30d62bf8d8d1d..76ab50b0d6ef382654178d1f87777244ae06ac4c 100644 (file)
@@ -487,7 +487,6 @@ static int ipip_rcv(struct sk_buff *skb)
 
                skb->mac.raw = skb->nh.raw;
                skb->nh.raw = skb->data;
-               memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
                skb->protocol = htons(ETH_P_IP);
                skb->pkt_type = PACKET_HOST;
 
index ba33f8621c6785fd71edf76e27e117a1cc1f397c..9ccacf57f08bd8ff7a0e6315ae6766f6744fb59c 100644 (file)
@@ -1461,7 +1461,6 @@ int pim_rcv_v1(struct sk_buff * skb)
        skb_pull(skb, (u8*)encap - skb->data);
        skb->nh.iph = (struct iphdr *)skb->data;
        skb->dev = reg_dev;
-       memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
        skb->protocol = htons(ETH_P_IP);
        skb->ip_summed = 0;
        skb->pkt_type = PACKET_HOST;
@@ -1517,7 +1516,6 @@ static int pim_rcv(struct sk_buff * skb)
        skb_pull(skb, (u8*)encap - skb->data);
        skb->nh.iph = (struct iphdr *)skb->data;
        skb->dev = reg_dev;
-       memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
        skb->protocol = htons(ETH_P_IP);
        skb->ip_summed = 0;
        skb->pkt_type = PACKET_HOST;
index f28ec68821622d7036132137f2af56f314f31a75..6a28fafe910c2a6ef858a900e688c682d9c470d5 100644 (file)
@@ -735,12 +735,11 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest,
        if (atype != RTN_LOCAL && atype != RTN_UNICAST)
                return -EINVAL;
 
-       dest = kmalloc(sizeof(struct ip_vs_dest), GFP_ATOMIC);
+       dest = kzalloc(sizeof(struct ip_vs_dest), GFP_ATOMIC);
        if (dest == NULL) {
                IP_VS_ERR("ip_vs_new_dest: kmalloc failed.\n");
                return -ENOMEM;
        }
-       memset(dest, 0, sizeof(struct ip_vs_dest));
 
        dest->protocol = svc->protocol;
        dest->vaddr = svc->addr;
@@ -1050,14 +1049,12 @@ ip_vs_add_service(struct ip_vs_service_user *u, struct ip_vs_service **svc_p)
                goto out_mod_dec;
        }
 
-       svc = (struct ip_vs_service *)
-               kmalloc(sizeof(struct ip_vs_service), GFP_ATOMIC);
+       svc = kzalloc(sizeof(struct ip_vs_service), GFP_ATOMIC);
        if (svc == NULL) {
                IP_VS_DBG(1, "ip_vs_add_service: kmalloc failed.\n");
                ret = -ENOMEM;
                goto out_err;
        }
-       memset(svc, 0, sizeof(struct ip_vs_service));
 
        /* I'm the first user of the service */
        atomic_set(&svc->usecnt, 1);
@@ -1797,7 +1794,7 @@ static int ip_vs_info_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct ip_vs_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct ip_vs_iter *s = kzalloc(sizeof(*s), GFP_KERNEL);
 
        if (!s)
                goto out;
@@ -1808,7 +1805,6 @@ static int ip_vs_info_open(struct inode *inode, struct file *file)
 
        seq          = file->private_data;
        seq->private = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
index 4c1940381ba0f38311c78e1d9f22407d2fe4d343..7d68b80c4c19534679c29c400a35fdd5a00c9295 100644 (file)
@@ -123,11 +123,10 @@ int ip_vs_new_estimator(struct ip_vs_stats *stats)
 {
        struct ip_vs_estimator *est;
 
-       est = kmalloc(sizeof(*est), GFP_KERNEL);
+       est = kzalloc(sizeof(*est), GFP_KERNEL);
        if (est == NULL)
                return -ENOMEM;
 
-       memset(est, 0, sizeof(*est));
        est->stats = stats;
        est->last_conns = stats->conns;
        est->cps = stats->cps<<10;
index cbffeae3f565703d607c2431ebcce355e5925a37..d994c5f5744ceb5373712e040954a8eac3233a61 100644 (file)
@@ -172,11 +172,10 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, u_int32_t ip,
        struct clusterip_config *c;
        char buffer[16];
 
-       c = kmalloc(sizeof(*c), GFP_ATOMIC);
+       c = kzalloc(sizeof(*c), GFP_ATOMIC);
        if (!c)
                return NULL;
 
-       memset(c, 0, sizeof(*c));
        c->dev = dev;
        c->clusterip = ip;
        memcpy(&c->clustermac, &i->clustermac, ETH_ALEN);
index a891133f00e48fa2bf3e17f7f938a810e1f07d29..f6f39e8142917e5a7fa841adaaf096b340c7c1d6 100644 (file)
@@ -1640,10 +1640,9 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
        if (unlikely(afinfo == NULL))
                return -EINVAL;
 
-       s = kmalloc(sizeof(*s), GFP_KERNEL);
+       s = kzalloc(sizeof(*s), GFP_KERNEL);
        if (!s)
                return -ENOMEM;
-       memset(s, 0, sizeof(*s));
        s->family               = afinfo->family;
        s->seq_ops.start        = tcp_seq_start;
        s->seq_ops.next         = tcp_seq_next;
index 9bfcddad695b0c4e3a2c3bb5dde02454ffa8266e..f136cec96d959c2f94c18078ae35b62a68985099 100644 (file)
@@ -1468,11 +1468,10 @@ static int udp_seq_open(struct inode *inode, struct file *file)
        struct udp_seq_afinfo *afinfo = PDE(inode)->data;
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct udp_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct udp_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
 
        if (!s)
                goto out;
-       memset(s, 0, sizeof(*s));
        s->family               = afinfo->family;
        s->seq_ops.start        = udp_seq_start;
        s->seq_ops.next         = udp_seq_next;
index f8d880beb12f6277b005a4fdc9eb7e7e0e9ec4cd..13cafbe56ce362e482a1e2ec2ed82f821fc82730 100644 (file)
@@ -92,7 +92,6 @@ static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
        skb->mac.raw = memmove(skb->data - skb->mac_len,
                               skb->mac.raw, skb->mac_len);
        skb->nh.raw = skb->data;
-       memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
        err = 0;
 
 out:
index bc77c0e1a943520fd31f4caf6b0bd5f23b1bba5f..84d7ebdb9d211103c678579009d6c24dc905379f 100644 (file)
@@ -567,10 +567,9 @@ static inline struct ipv6_txoptions *create_tel(__u8 encap_limit)
 
        int opt_len = sizeof(*opt) + 8;
 
-       if (!(opt = kmalloc(opt_len, GFP_ATOMIC))) {
+       if (!(opt = kzalloc(opt_len, GFP_ATOMIC))) {
                return NULL;
        }
-       memset(opt, 0, opt_len);
        opt->tot_len = opt_len;
        opt->dst0opt = (struct ipv6_opt_hdr *) (opt + 1);
        opt->opt_nflen = 8;
index c56aeece2bf59cff97a63c91fb366327637e73f3..836eecd7e62bfaa100a616d5aeda26ecc652ada9 100644 (file)
@@ -380,7 +380,6 @@ static int ipip6_rcv(struct sk_buff *skb)
                secpath_reset(skb);
                skb->mac.raw = skb->nh.raw;
                skb->nh.raw = skb->data;
-               memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
                IPCB(skb)->flags = 0;
                skb->protocol = htons(ETH_P_IPV6);
                skb->pkt_type = PACKET_HOST;
index 7fae48a53bffaddd35205424ed5ec452171b8911..17699eeb64d78274481bca74888dfc41313fb548 100644 (file)
@@ -308,7 +308,7 @@ static void irda_connect_response(struct irda_sock *self)
 
        IRDA_ASSERT(self != NULL, return;);
 
-       skb = dev_alloc_skb(64);
+       skb = alloc_skb(64, GFP_ATOMIC);
        if (skb == NULL) {
                IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n",
                           __FUNCTION__);
index 9c4a902a9dba79c0bdb315e926484d26b7b21829..ad6b6af3dd976c97bd75818f55e4361421923529 100644 (file)
@@ -115,12 +115,10 @@ struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line)
 
        IRDA_ASSERT(ircomm != NULL, return NULL;);
 
-       self = kmalloc(sizeof(struct ircomm_cb), GFP_ATOMIC);
+       self = kzalloc(sizeof(struct ircomm_cb), GFP_ATOMIC);
        if (self == NULL)
                return NULL;
 
-       memset(self, 0, sizeof(struct ircomm_cb));
-
        self->notify = *notify;
        self->magic = IRCOMM_MAGIC;
 
index d9097207aed3c03ea93a2668fd6d1b21c0dfe91b..959874b6451f00cf9edf4ad23343a1cd07e73b5b 100644 (file)
@@ -81,7 +81,7 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
        
        /* Any userdata supplied? */
        if (userdata == NULL) {
-               tx_skb = dev_alloc_skb(64);
+               tx_skb = alloc_skb(64, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
@@ -115,7 +115,7 @@ static int ircomm_lmp_disconnect_request(struct ircomm_cb *self,
        IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
 
         if (!userdata) {
-               tx_skb = dev_alloc_skb(64);
+               tx_skb = alloc_skb(64, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
                
index 6009bab05091387d54af9f13a745e8f6d23a2093..a39f5735a90bffeb854d843fbeb58091ba93419c 100644 (file)
@@ -121,7 +121,7 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush)
 
        skb = self->ctrl_skb;   
        if (!skb) {
-               skb = dev_alloc_skb(256);
+               skb = alloc_skb(256, GFP_ATOMIC);
                if (!skb) {
                        spin_unlock_irqrestore(&self->spinlock, flags);
                        return -ENOMEM;
index b400f27851fc5885985ae05527716236b04de88c..3bcdb467efc5658dd525d924acfd3faffd2adccb 100644 (file)
@@ -379,12 +379,11 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
        self = hashbin_lock_find(ircomm_tty, line, NULL);
        if (!self) {
                /* No, so make new instance */
-               self = kmalloc(sizeof(struct ircomm_tty_cb), GFP_KERNEL);
+               self = kzalloc(sizeof(struct ircomm_tty_cb), GFP_KERNEL);
                if (self == NULL) {
                        IRDA_ERROR("%s(), kmalloc failed!\n", __FUNCTION__);
                        return -ENOMEM;
                }
-               memset(self, 0, sizeof(struct ircomm_tty_cb));
                
                self->magic = IRCOMM_TTY_MAGIC;
                self->flow = FLOW_STOP;
@@ -759,8 +758,9 @@ static int ircomm_tty_write(struct tty_struct *tty,
                        }
                } else {
                        /* Prepare a full sized frame */
-                       skb = dev_alloc_skb(self->max_data_size+
-                                           self->max_header_size);
+                       skb = alloc_skb(self->max_data_size+
+                                       self->max_header_size,
+                                       GFP_ATOMIC);
                        if (!skb) {
                                spin_unlock_irqrestore(&self->spinlock, flags);
                                return -ENOBUFS;
index ba40e5495f58d0dd640b7ea3eed4fdcdf9e3b6a4..7e7a31798d8d04855fead92b2ebdb444f85ea26a 100644 (file)
@@ -401,12 +401,10 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
        }
 
        /* Allocate dongle info for this instance */
-       dongle = kmalloc(sizeof(dongle_t), GFP_KERNEL);
+       dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL);
        if (!dongle)
                goto out;
 
-       memset(dongle, 0, sizeof(dongle_t));
-
        /* Bind the registration info to this particular instance */
        dongle->issue = reg;
        dongle->dev = dev;
index a0472652a44e4318a9a5633e2ee9a337e079e0e9..61128aa05b4015c9fb85027bd1cc870b34a9beec 100644 (file)
@@ -345,7 +345,7 @@ static void iriap_disconnect_request(struct iriap_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
 
-       tx_skb = dev_alloc_skb(64);
+       tx_skb = alloc_skb(64, GFP_ATOMIC);
        if (tx_skb == NULL) {
                IRDA_DEBUG(0, "%s(), Could not allocate an sk_buff of length %d\n", 
                        __FUNCTION__, 64);
@@ -396,7 +396,7 @@ int iriap_getvaluebyclass_request(struct iriap_cb *self,
        attr_len = strlen(attr);        /* Up to IAS_MAX_ATTRIBNAME = 60 */
 
        skb_len = self->max_header_size+2+name_len+1+attr_len+4;
-       tx_skb = dev_alloc_skb(skb_len);
+       tx_skb = alloc_skb(skb_len, GFP_ATOMIC);
        if (!tx_skb)
                return -ENOMEM;
 
@@ -562,7 +562,8 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self,
         *  value. We add 32 bytes because of the 6 bytes for the frame and
         *  max 5 bytes for the value coding.
         */
-       tx_skb = dev_alloc_skb(value->len + self->max_header_size + 32);
+       tx_skb = alloc_skb(value->len + self->max_header_size + 32,
+                          GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -700,7 +701,7 @@ void iriap_send_ack(struct iriap_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
 
-       tx_skb = dev_alloc_skb(64);
+       tx_skb = alloc_skb(64, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
index a73607450de1b9142d03904a3d60a6eb8c7a89d1..da17395df05adab0dab896b9e64f59ff1d4f62ab 100644 (file)
@@ -365,7 +365,7 @@ static void state_r_disconnect(struct iriap_cb *self, IRIAP_EVENT event,
 
        switch (event) {
        case IAP_LM_CONNECT_INDICATION:
-               tx_skb = dev_alloc_skb(64);
+               tx_skb = alloc_skb(64, GFP_ATOMIC);
                if (tx_skb == NULL) {
                        IRDA_WARNING("%s: unable to malloc!\n", __FUNCTION__);
                        return;
index 82e665c7999183b6300283370a1b463865bc5c7d..a154b1d71c0f8d9af8e0f0c429886c5cdbe8b44c 100644 (file)
@@ -82,13 +82,12 @@ struct ias_object *irias_new_object( char *name, int id)
 
        IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
 
-       obj = kmalloc(sizeof(struct ias_object), GFP_ATOMIC);
+       obj = kzalloc(sizeof(struct ias_object), GFP_ATOMIC);
        if (obj == NULL) {
                IRDA_WARNING("%s(), Unable to allocate object!\n",
                             __FUNCTION__);
                return NULL;
        }
-       memset(obj, 0, sizeof( struct ias_object));
 
        obj->magic = IAS_OBJECT_MAGIC;
        obj->name = strndup(name, IAS_MAX_CLASSNAME);
@@ -346,13 +345,12 @@ void irias_add_integer_attrib(struct ias_object *obj, char *name, int value,
        IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
        IRDA_ASSERT(name != NULL, return;);
 
-       attrib = kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC);
+       attrib = kzalloc(sizeof(struct ias_attrib), GFP_ATOMIC);
        if (attrib == NULL) {
                IRDA_WARNING("%s: Unable to allocate attribute!\n",
                             __FUNCTION__);
                return;
        }
-       memset(attrib, 0, sizeof( struct ias_attrib));
 
        attrib->magic = IAS_ATTRIB_MAGIC;
        attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);
@@ -382,13 +380,12 @@ void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
        IRDA_ASSERT(name != NULL, return;);
        IRDA_ASSERT(octets != NULL, return;);
 
-       attrib = kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC);
+       attrib = kzalloc(sizeof(struct ias_attrib), GFP_ATOMIC);
        if (attrib == NULL) {
                IRDA_WARNING("%s: Unable to allocate attribute!\n",
                             __FUNCTION__);
                return;
        }
-       memset(attrib, 0, sizeof( struct ias_attrib));
 
        attrib->magic = IAS_ATTRIB_MAGIC;
        attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);
@@ -416,13 +413,12 @@ void irias_add_string_attrib(struct ias_object *obj, char *name, char *value,
        IRDA_ASSERT(name != NULL, return;);
        IRDA_ASSERT(value != NULL, return;);
 
-       attrib = kmalloc(sizeof( struct ias_attrib), GFP_ATOMIC);
+       attrib = kzalloc(sizeof( struct ias_attrib), GFP_ATOMIC);
        if (attrib == NULL) {
                IRDA_WARNING("%s: Unable to allocate attribute!\n",
                             __FUNCTION__);
                return;
        }
-       memset(attrib, 0, sizeof( struct ias_attrib));
 
        attrib->magic = IAS_ATTRIB_MAGIC;
        attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);
@@ -443,12 +439,11 @@ struct ias_value *irias_new_integer_value(int integer)
 {
        struct ias_value *value;
 
-       value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
+       value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC);
        if (value == NULL) {
                IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
                return NULL;
        }
-       memset(value, 0, sizeof(struct ias_value));
 
        value->type = IAS_INTEGER;
        value->len = 4;
@@ -469,12 +464,11 @@ struct ias_value *irias_new_string_value(char *string)
 {
        struct ias_value *value;
 
-       value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
+       value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC);
        if (value == NULL) {
                IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
                return NULL;
        }
-       memset( value, 0, sizeof( struct ias_value));
 
        value->type = IAS_STRING;
        value->charset = CS_ASCII;
@@ -495,12 +489,11 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len)
 {
        struct ias_value *value;
 
-       value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
+       value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC);
        if (value == NULL) {
                IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
                return NULL;
        }
-       memset(value, 0, sizeof(struct ias_value));
 
        value->type = IAS_OCT_SEQ;
        /* Check length */
@@ -522,12 +515,11 @@ struct ias_value *irias_new_missing_value(void)
 {
        struct ias_value *value;
 
-       value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
+       value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC);
        if (value == NULL) {
                IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
                return NULL;
        }
-       memset(value, 0, sizeof(struct ias_value));
 
        value->type = IAS_MISSING;
        value->len = 0;
index bd659dd545accb924bc3f828ce24471a9c997d4a..7dd0a2fe1d20dfac9a51b60fc4724c64e8c38b84 100644 (file)
@@ -636,7 +636,7 @@ void irlan_get_provider_info(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 
-       skb = dev_alloc_skb(64);
+       skb = alloc_skb(64, GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -668,7 +668,7 @@ void irlan_open_data_channel(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
        
-       skb = dev_alloc_skb(64);
+       skb = alloc_skb(64, GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -704,7 +704,7 @@ void irlan_close_data_channel(struct irlan_cb *self)
        if (self->client.tsap_ctrl == NULL)
                return;
 
-       skb = dev_alloc_skb(64);
+       skb = alloc_skb(64, GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -739,7 +739,7 @@ static void irlan_open_unicast_addr(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);       
        
-       skb = dev_alloc_skb(128);
+       skb = alloc_skb(128, GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -777,7 +777,7 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
        
-       skb = dev_alloc_skb(128);
+       skb = alloc_skb(128, GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -816,7 +816,7 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 
-       skb = dev_alloc_skb(128);
+       skb = alloc_skb(128, GFP_ATOMIC);
        if (!skb)
                return;
        
@@ -856,7 +856,7 @@ static void irlan_get_unicast_addr(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
        
-       skb = dev_alloc_skb(128);
+       skb = alloc_skb(128, GFP_ATOMIC);
        if (!skb)
                return;
 
@@ -891,7 +891,7 @@ void irlan_get_media_char(struct irlan_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
        
-       skb = dev_alloc_skb(64);
+       skb = alloc_skb(64, GFP_ATOMIC);
        if (!skb)
                return;
 
index 39c202d1c3747cbd8ae71879a20f132f03a1b563..9c0df86044d7d4aaeabe71c0be10667dda723a10 100644 (file)
@@ -296,7 +296,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 
-       skb = dev_alloc_skb(128);
+       skb = alloc_skb(128, GFP_ATOMIC);
        if (!skb)
                return;
 
index cade355ac8af51387b385d74052771ad9b6d32e4..e7852a07495e44785c4b42148d22f69e12dd9fc7 100644 (file)
@@ -116,11 +116,10 @@ struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos,
        IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
 
        /* Initialize the irlap structure. */
-       self = kmalloc(sizeof(struct irlap_cb), GFP_KERNEL);
+       self = kzalloc(sizeof(struct irlap_cb), GFP_KERNEL);
        if (self == NULL)
                return NULL;
 
-       memset(self, 0, sizeof(struct irlap_cb));
        self->magic = LAP_MAGIC;
 
        /* Make a binding between the layers */
@@ -882,7 +881,7 @@ static void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now)
        /* Change speed now, or just piggyback speed on frames */
        if (now) {
                /* Send down empty frame to trigger speed change */
-               skb = dev_alloc_skb(0);
+               skb = alloc_skb(0, GFP_ATOMIC);
                if (skb)
                        irlap_queue_xmit(self, skb);
        }
@@ -1222,7 +1221,7 @@ static int irlap_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct irlap_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct irlap_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
        
        if (!s)
                goto out;
@@ -1238,7 +1237,6 @@ static int irlap_seq_open(struct inode *inode, struct file *file)
 
        seq          = file->private_data;
        seq->private = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
index 3e9a06abbdd08d8e223169bb4f0155b6dd409138..ccb983bf0f4a222a8f848a0a8162b327c5d01d8e 100644 (file)
@@ -117,7 +117,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
 
        /* Allocate frame */
-       tx_skb = dev_alloc_skb(64);
+       tx_skb = alloc_skb(64, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -210,7 +210,7 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos)
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
 
        /* Allocate frame */
-       tx_skb = dev_alloc_skb(64);
+       tx_skb = alloc_skb(64, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -250,7 +250,7 @@ void irlap_send_dm_frame( struct irlap_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
 
-       tx_skb = dev_alloc_skb(32);
+       tx_skb = alloc_skb(32, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -282,7 +282,7 @@ void irlap_send_disc_frame(struct irlap_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
 
-       tx_skb = dev_alloc_skb(16);
+       tx_skb = alloc_skb(16, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -315,7 +315,7 @@ void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s,
        IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
        IRDA_ASSERT(discovery != NULL, return;);
 
-       tx_skb = dev_alloc_skb(64);
+       tx_skb = alloc_skb(64, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -422,11 +422,10 @@ static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self,
                return;
        }
 
-       if ((discovery = kmalloc(sizeof(discovery_t), GFP_ATOMIC)) == NULL) {
+       if ((discovery = kzalloc(sizeof(discovery_t), GFP_ATOMIC)) == NULL) {
                IRDA_WARNING("%s: kmalloc failed!\n", __FUNCTION__);
                return;
        }
-       memset(discovery, 0, sizeof(discovery_t));
 
        discovery->data.daddr = info->daddr;
        discovery->data.saddr = self->saddr;
@@ -576,7 +575,7 @@ void irlap_send_rr_frame(struct irlap_cb *self, int command)
        struct sk_buff *tx_skb;
        __u8 *frame;
 
-       tx_skb = dev_alloc_skb(16);
+       tx_skb = alloc_skb(16, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -601,7 +600,7 @@ void irlap_send_rd_frame(struct irlap_cb *self)
        struct sk_buff *tx_skb;
        __u8 *frame;
 
-       tx_skb = dev_alloc_skb(16);
+       tx_skb = alloc_skb(16, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -1215,7 +1214,7 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
        struct test_frame *frame;
        __u8 *info;
 
-       tx_skb = dev_alloc_skb(cmd->len+sizeof(struct test_frame));
+       tx_skb = alloc_skb(cmd->len+sizeof(struct test_frame), GFP_ATOMIC);
        if (!tx_skb)
                return;
 
index 129ad64c15bbcd069f6c61086e510b7b7e50907d..c440913dee1468358e76cdef1fef6eeaad3d22a5 100644 (file)
@@ -78,10 +78,9 @@ int __init irlmp_init(void)
 {
        IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
        /* Initialize the irlmp structure. */
-       irlmp = kmalloc( sizeof(struct irlmp_cb), GFP_KERNEL);
+       irlmp = kzalloc( sizeof(struct irlmp_cb), GFP_KERNEL);
        if (irlmp == NULL)
                return -ENOMEM;
-       memset(irlmp, 0, sizeof(struct irlmp_cb));
 
        irlmp->magic = LMP_MAGIC;
 
@@ -160,12 +159,11 @@ struct lsap_cb *irlmp_open_lsap(__u8 slsap_sel, notify_t *notify, __u8 pid)
                return NULL;
 
        /* Allocate new instance of a LSAP connection */
-       self = kmalloc(sizeof(struct lsap_cb), GFP_ATOMIC);
+       self = kzalloc(sizeof(struct lsap_cb), GFP_ATOMIC);
        if (self == NULL) {
                IRDA_ERROR("%s: can't allocate memory\n", __FUNCTION__);
                return NULL;
        }
-       memset(self, 0, sizeof(struct lsap_cb));
 
        self->magic = LMP_LSAP_MAGIC;
        self->slsap_sel = slsap_sel;
@@ -288,12 +286,11 @@ void irlmp_register_link(struct irlap_cb *irlap, __u32 saddr, notify_t *notify)
        /*
         *  Allocate new instance of a LSAP connection
         */
-       lap = kmalloc(sizeof(struct lap_cb), GFP_KERNEL);
+       lap = kzalloc(sizeof(struct lap_cb), GFP_KERNEL);
        if (lap == NULL) {
                IRDA_ERROR("%s: unable to kmalloc\n", __FUNCTION__);
                return;
        }
-       memset(lap, 0, sizeof(struct lap_cb));
 
        lap->irlap = irlap;
        lap->magic = LMP_LAP_MAGIC;
@@ -395,7 +392,7 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
 
        /* Any userdata? */
        if (tx_skb == NULL) {
-               tx_skb = dev_alloc_skb(64);
+               tx_skb = alloc_skb(64, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
index e53bf9e0053ee831d46639a4e70917c0436af585..a1e502ff90709a0e98b1da34e48e88eee7bd019c 100644 (file)
@@ -476,11 +476,10 @@ dev_irnet_open(struct inode *     inode,
 #endif /* SECURE_DEVIRNET */
 
   /* Allocate a private structure for this IrNET instance */
-  ap = kmalloc(sizeof(*ap), GFP_KERNEL);
+  ap = kzalloc(sizeof(*ap), GFP_KERNEL);
   DABORT(ap == NULL, -ENOMEM, FS_ERROR, "Can't allocate struct irnet...\n");
 
   /* initialize the irnet structure */
-  memset(ap, 0, sizeof(*ap));
   ap->file = file;
 
   /* PPP channel setup */
index 49c51c5f1a86774c3369d2ae057eb2321fa9dc38..42acf1cde737d4e0b992df9a6d469311385db410 100644 (file)
@@ -85,10 +85,9 @@ static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 };
  */
 int __init irttp_init(void)
 {
-       irttp = kmalloc(sizeof(struct irttp_cb), GFP_KERNEL);
+       irttp = kzalloc(sizeof(struct irttp_cb), GFP_KERNEL);
        if (irttp == NULL)
                return -ENOMEM;
-       memset(irttp, 0, sizeof(struct irttp_cb));
 
        irttp->magic = TTP_MAGIC;
 
@@ -306,7 +305,8 @@ static inline void irttp_fragment_skb(struct tsap_cb *self,
                IRDA_DEBUG(2, "%s(), fragmenting ...\n", __FUNCTION__);
 
                /* Make new segment */
-               frag = dev_alloc_skb(self->max_seg_size+self->max_header_size);
+               frag = alloc_skb(self->max_seg_size+self->max_header_size,
+                                GFP_ATOMIC);
                if (!frag)
                        return;
 
@@ -389,12 +389,11 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
                return NULL;
        }
 
-       self = kmalloc(sizeof(struct tsap_cb), GFP_ATOMIC);
+       self = kzalloc(sizeof(struct tsap_cb), GFP_ATOMIC);
        if (self == NULL) {
                IRDA_DEBUG(0, "%s(), unable to kmalloc!\n", __FUNCTION__);
                return NULL;
        }
-       memset(self, 0, sizeof(struct tsap_cb));
        spin_lock_init(&self->lock);
 
        /* Initialise todo timer */
@@ -805,7 +804,7 @@ static inline void irttp_give_credit(struct tsap_cb *self)
                   self->send_credit, self->avail_credit, self->remote_credit);
 
        /* Give credit to peer */
-       tx_skb = dev_alloc_skb(64);
+       tx_skb = alloc_skb(64, GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -1094,7 +1093,7 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel,
 
        /* Any userdata supplied? */
        if (userdata == NULL) {
-               tx_skb = dev_alloc_skb(64);
+               tx_skb = alloc_skb(64, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
@@ -1342,7 +1341,7 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size,
 
        /* Any userdata supplied? */
        if (userdata == NULL) {
-               tx_skb = dev_alloc_skb(64);
+               tx_skb = alloc_skb(64, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
@@ -1541,7 +1540,7 @@ int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata,
 
        if (!userdata) {
                struct sk_buff *tx_skb;
-               tx_skb = dev_alloc_skb(64);
+               tx_skb = alloc_skb(64, GFP_ATOMIC);
                if (!tx_skb)
                        return -ENOMEM;
 
@@ -1876,7 +1875,7 @@ static int irttp_seq_open(struct inode *inode, struct file *file)
        int rc = -ENOMEM;
        struct irttp_iter_state *s;
 
-       s = kmalloc(sizeof(*s), GFP_KERNEL);
+       s = kzalloc(sizeof(*s), GFP_KERNEL);
        if (!s)
                goto out;
 
@@ -1886,7 +1885,6 @@ static int irttp_seq_open(struct inode *inode, struct file *file)
 
        seq          = file->private_data;
        seq->private = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
index aea6616cea3d1d48eceb3e12ab3aa0b670625847..d504eed416f6a468fb95c7d8da9aa2cebdf3813a 100644 (file)
@@ -115,14 +115,12 @@ static struct lapb_cb *lapb_devtostruct(struct net_device *dev)
  */
 static struct lapb_cb *lapb_create_cb(void)
 {
-       struct lapb_cb *lapb = kmalloc(sizeof(*lapb), GFP_ATOMIC);
+       struct lapb_cb *lapb = kzalloc(sizeof(*lapb), GFP_ATOMIC);
 
 
        if (!lapb)
                goto out;
 
-       memset(lapb, 0x00, sizeof(*lapb));
-
        skb_queue_head_init(&lapb->write_queue);
        skb_queue_head_init(&lapb->ack_queue);
 
index bd242a49514add8e1d9a128b937904389e065dbc..d12413cff5bd77085d0571703263f97d1bf3b077 100644 (file)
@@ -33,10 +33,9 @@ unsigned char llc_station_mac_sa[ETH_ALEN];
  */
 static struct llc_sap *llc_sap_alloc(void)
 {
-       struct llc_sap *sap = kmalloc(sizeof(*sap), GFP_ATOMIC);
+       struct llc_sap *sap = kzalloc(sizeof(*sap), GFP_ATOMIC);
 
        if (sap) {
-               memset(sap, 0, sizeof(*sap));
                sap->state = LLC_SAP_STATE_ACTIVE;
                memcpy(sap->laddr.mac, llc_station_mac_sa, ETH_ALEN);
                rwlock_init(&sap->sk_list.lock);
index 55c0adc8f11501c6b1b130ffb68e6a0588165e62..b85c1f9f12885409a6ac744003fa2c2e2a655077 100644 (file)
@@ -562,10 +562,9 @@ static int netlink_alloc_groups(struct sock *sk)
        if (err)
                return err;
 
-       nlk->groups = kmalloc(NLGRPSZ(groups), GFP_KERNEL);
+       nlk->groups = kzalloc(NLGRPSZ(groups), GFP_KERNEL);
        if (nlk->groups == NULL)
                return -ENOMEM;
-       memset(nlk->groups, 0, NLGRPSZ(groups));
        nlk->ngroups = groups;
        return 0;
 }
@@ -1393,11 +1392,10 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
        struct sock *sk;
        struct netlink_sock *nlk;
 
-       cb = kmalloc(sizeof(*cb), GFP_KERNEL);
+       cb = kzalloc(sizeof(*cb), GFP_KERNEL);
        if (cb == NULL)
                return -ENOBUFS;
 
-       memset(cb, 0, sizeof(*cb));
        cb->dump = dump;
        cb->done = done;
        cb->nlh = nlh;
@@ -1668,7 +1666,7 @@ static int netlink_seq_open(struct inode *inode, struct file *file)
        struct nl_seq_iter *iter;
        int err;
 
-       iter = kmalloc(sizeof(*iter), GFP_KERNEL);
+       iter = kzalloc(sizeof(*iter), GFP_KERNEL);
        if (!iter)
                return -ENOMEM;
 
@@ -1678,7 +1676,6 @@ static int netlink_seq_open(struct inode *inode, struct file *file)
                return err;
        }
 
-       memset(iter, 0, sizeof(*iter));
        seq = file->private_data;
        seq->private = iter;
        return 0;
@@ -1747,15 +1744,13 @@ static int __init netlink_proto_init(void)
        if (sizeof(struct netlink_skb_parms) > sizeof(dummy_skb->cb))
                netlink_skb_parms_too_large();
 
-       nl_table = kmalloc(sizeof(*nl_table) * MAX_LINKS, GFP_KERNEL);
+       nl_table = kcalloc(MAX_LINKS, sizeof(*nl_table), GFP_KERNEL);
        if (!nl_table) {
 enomem:
                printk(KERN_CRIT "netlink_init: Cannot allocate nl_table\n");
                return -ENOMEM;
        }
 
-       memset(nl_table, 0, sizeof(*nl_table) * MAX_LINKS);
-
        if (num_physpages >= (128 * 1024))
                max = num_physpages >> (21 - PAGE_SHIFT);
        else
index 573b572f8f91dfceda7d60a3fb67b8dc8588f0f1..93d2c55ad2d5decf115080ba0e5733caa037cd49 100644 (file)
@@ -58,13 +58,12 @@ static inline int __rxrpc_create_connection(struct rxrpc_peer *peer,
        _enter("%p",peer);
 
        /* allocate and initialise a connection record */
-       conn = kmalloc(sizeof(struct rxrpc_connection), GFP_KERNEL);
+       conn = kzalloc(sizeof(struct rxrpc_connection), GFP_KERNEL);
        if (!conn) {
                _leave(" = -ENOMEM");
                return -ENOMEM;
        }
 
-       memset(conn, 0, sizeof(struct rxrpc_connection));
        atomic_set(&conn->usage, 1);
 
        INIT_LIST_HEAD(&conn->link);
@@ -535,13 +534,12 @@ int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
                return -EINVAL;
        }
 
-       msg = kmalloc(sizeof(struct rxrpc_message), alloc_flags);
+       msg = kzalloc(sizeof(struct rxrpc_message), alloc_flags);
        if (!msg) {
                _leave(" = -ENOMEM");
                return -ENOMEM;
        }
 
-       memset(msg, 0, sizeof(*msg));
        atomic_set(&msg->usage, 1);
 
        INIT_LIST_HEAD(&msg->link);
index ed38f5b17c1bd462ae25107322344fd7b5e201b0..8a275157a3bb1b7927d268fae7d07455be5fa5bd 100644 (file)
@@ -58,13 +58,12 @@ static int __rxrpc_create_peer(struct rxrpc_transport *trans, __be32 addr,
        _enter("%p,%08x", trans, ntohl(addr));
 
        /* allocate and initialise a peer record */
-       peer = kmalloc(sizeof(struct rxrpc_peer), GFP_KERNEL);
+       peer = kzalloc(sizeof(struct rxrpc_peer), GFP_KERNEL);
        if (!peer) {
                _leave(" = -ENOMEM");
                return -ENOMEM;
        }
 
-       memset(peer, 0, sizeof(struct rxrpc_peer));
        atomic_set(&peer->usage, 1);
 
        INIT_LIST_HEAD(&peer->link);
index dbe6105e83a54e1f9ce66b4466a2863e0d7f155f..465efc86fccf1f253cf93a4e5705017e6e1dd83d 100644 (file)
@@ -68,11 +68,10 @@ int rxrpc_create_transport(unsigned short port,
 
        _enter("%hu", port);
 
-       trans = kmalloc(sizeof(struct rxrpc_transport), GFP_KERNEL);
+       trans = kzalloc(sizeof(struct rxrpc_transport), GFP_KERNEL);
        if (!trans)
                return -ENOMEM;
 
-       memset(trans, 0, sizeof(struct rxrpc_transport));
        atomic_set(&trans->usage, 1);
        INIT_LIST_HEAD(&trans->services);
        INIT_LIST_HEAD(&trans->link);
@@ -312,13 +311,12 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans,
 
        _enter("");
 
-       msg = kmalloc(sizeof(struct rxrpc_message), GFP_KERNEL);
+       msg = kzalloc(sizeof(struct rxrpc_message), GFP_KERNEL);
        if (!msg) {
                _leave(" = -ENOMEM");
                return -ENOMEM;
        }
 
-       memset(msg, 0, sizeof(*msg));
        atomic_set(&msg->usage, 1);
        list_add_tail(&msg->link,msgq);
 
index 9affeeedf1070372650677711f0ccb97578e7cfa..a2587b52e531d7284bb85078d9d3c783a4f5dde2 100644 (file)
@@ -312,10 +312,9 @@ struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
        }
 
        *err = -ENOMEM;
-       a = kmalloc(sizeof(*a), GFP_KERNEL);
+       a = kzalloc(sizeof(*a), GFP_KERNEL);
        if (a == NULL)
                goto err_mod;
-       memset(a, 0, sizeof(*a));
 
        /* backward compatibility for policer */
        if (name == NULL)
@@ -492,10 +491,9 @@ tcf_action_get_1(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int *err)
        index = *(int *)RTA_DATA(tb[TCA_ACT_INDEX - 1]);
 
        *err = -ENOMEM;
-       a = kmalloc(sizeof(struct tc_action), GFP_KERNEL);
+       a = kzalloc(sizeof(struct tc_action), GFP_KERNEL);
        if (a == NULL)
                return NULL;
-       memset(a, 0, sizeof(struct tc_action));
 
        *err = -EINVAL;
        a->ops = tc_lookup_action(tb[TCA_ACT_KIND - 1]);
@@ -531,12 +529,11 @@ static struct tc_action *create_a(int i)
 {
        struct tc_action *act;
 
-       act = kmalloc(sizeof(*act), GFP_KERNEL);
+       act = kzalloc(sizeof(*act), GFP_KERNEL);
        if (act == NULL) {
                printk("create_a: failed to alloc!\n");
                return NULL;
        }
-       memset(act, 0, sizeof(*act));
        act->order = i;
        return act;
 }
index 58b3a8652042fa2d90c5061616b93ff83b888392..f257475e0e0c996ba39a333f2f7c4386573ed250 100644 (file)
@@ -209,10 +209,9 @@ tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,int bind, int ref)
        s = sizeof(*opt) + p->nkeys * sizeof(struct tc_pedit_key);
 
        /* netlink spinlocks held above us - must use ATOMIC */
-       opt = kmalloc(s, GFP_ATOMIC);
+       opt = kzalloc(s, GFP_ATOMIC);
        if (opt == NULL)
                return -ENOBUFS;
-       memset(opt, 0, s);
 
        memcpy(opt->keys, p->keys, p->nkeys * sizeof(struct tc_pedit_key));
        opt->index = p->index;
index 47e00bd9625ef1864706e5d835481a61ed7aeead..da905d7b4b40fd02fb9878a32ceae31941236094 100644 (file)
@@ -196,10 +196,9 @@ static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,
                return ret;
        }
 
-       p = kmalloc(sizeof(*p), GFP_KERNEL);
+       p = kzalloc(sizeof(*p), GFP_KERNEL);
        if (p == NULL)
                return -ENOMEM;
-       memset(p, 0, sizeof(*p));
 
        ret = ACT_P_CREATED;
        p->refcnt = 1;
@@ -429,11 +428,10 @@ struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est)
                return p;
        }
 
-       p = kmalloc(sizeof(*p), GFP_KERNEL);
+       p = kzalloc(sizeof(*p), GFP_KERNEL);
        if (p == NULL)
                return NULL;
 
-       memset(p, 0, sizeof(*p));
        p->refcnt = 1;
        spin_lock_init(&p->lock);
        p->stats_lock = &p->lock;
index 61507f006b114e350fb5dee3febb3961ea965b9e..86cac49a0531476d716c31c9a195571063bb9117 100644 (file)
@@ -178,19 +178,17 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
 
        err = -ENOBUFS;
        if (head == NULL) {
-               head = kmalloc(sizeof(*head), GFP_KERNEL);
+               head = kzalloc(sizeof(*head), GFP_KERNEL);
                if (head == NULL)
                        goto errout;
 
-               memset(head, 0, sizeof(*head));
                INIT_LIST_HEAD(&head->flist);
                tp->root = head;
        }
 
-       f = kmalloc(sizeof(*f), GFP_KERNEL);
+       f = kzalloc(sizeof(*f), GFP_KERNEL);
        if (f == NULL)
                goto errout;
-       memset(f, 0, sizeof(*f));
 
        err = -EINVAL;
        if (handle)
index d41de91fc4f6fc559bdc5f658dfd2c886131f651..e6973d9b686d0e951f6a153a23059bb31619b7f8 100644 (file)
@@ -267,20 +267,18 @@ static int fw_change(struct tcf_proto *tp, unsigned long base,
                return -EINVAL;
 
        if (head == NULL) {
-               head = kmalloc(sizeof(struct fw_head), GFP_KERNEL);
+               head = kzalloc(sizeof(struct fw_head), GFP_KERNEL);
                if (head == NULL)
                        return -ENOBUFS;
-               memset(head, 0, sizeof(*head));
 
                tcf_tree_lock(tp);
                tp->root = head;
                tcf_tree_unlock(tp);
        }
 
-       f = kmalloc(sizeof(struct fw_filter), GFP_KERNEL);
+       f = kzalloc(sizeof(struct fw_filter), GFP_KERNEL);
        if (f == NULL)
                return -ENOBUFS;
-       memset(f, 0, sizeof(*f));
 
        f->id = handle;
 
index c2e71900f7bdd2f64ed400860623004342e12fd5..d3aea730d4c85d923cda240af52272d91cf6e5da 100644 (file)
@@ -396,10 +396,9 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base,
        h1 = to_hash(nhandle);
        if ((b = head->table[h1]) == NULL) {
                err = -ENOBUFS;
-               b = kmalloc(sizeof(struct route4_bucket), GFP_KERNEL);
+               b = kzalloc(sizeof(struct route4_bucket), GFP_KERNEL);
                if (b == NULL)
                        goto errout;
-               memset(b, 0, sizeof(*b));
 
                tcf_tree_lock(tp);
                head->table[h1] = b;
@@ -475,20 +474,18 @@ static int route4_change(struct tcf_proto *tp, unsigned long base,
 
        err = -ENOBUFS;
        if (head == NULL) {
-               head = kmalloc(sizeof(struct route4_head), GFP_KERNEL);
+               head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);
                if (head == NULL)
                        goto errout;
-               memset(head, 0, sizeof(struct route4_head));
 
                tcf_tree_lock(tp);
                tp->root = head;
                tcf_tree_unlock(tp);
        }
 
-       f = kmalloc(sizeof(struct route4_filter), GFP_KERNEL);
+       f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL);
        if (f == NULL)
                goto errout;
-       memset(f, 0, sizeof(*f));
 
        err = route4_set_parms(tp, base, f, handle, head, tb,
                tca[TCA_RATE-1], 1);
index ba87419716290204d4f1708ac978f74183c09804..6e230ecfba05f8ac39de22af6f36620404f1fd83 100644 (file)
@@ -240,9 +240,8 @@ static int rsvp_init(struct tcf_proto *tp)
 {
        struct rsvp_head *data;
 
-       data = kmalloc(sizeof(struct rsvp_head), GFP_KERNEL);
+       data = kzalloc(sizeof(struct rsvp_head), GFP_KERNEL);
        if (data) {
-               memset(data, 0, sizeof(struct rsvp_head));
                tp->root = data;
                return 0;
        }
@@ -446,11 +445,10 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base,
                goto errout2;
 
        err = -ENOBUFS;
-       f = kmalloc(sizeof(struct rsvp_filter), GFP_KERNEL);
+       f = kzalloc(sizeof(struct rsvp_filter), GFP_KERNEL);
        if (f == NULL)
                goto errout2;
 
-       memset(f, 0, sizeof(*f));
        h2 = 16;
        if (tb[TCA_RSVP_SRC-1]) {
                err = -EINVAL;
@@ -532,10 +530,9 @@ insert:
        /* No session found. Create new one. */
 
        err = -ENOBUFS;
-       s = kmalloc(sizeof(struct rsvp_session), GFP_KERNEL);
+       s = kzalloc(sizeof(struct rsvp_session), GFP_KERNEL);
        if (s == NULL)
                goto errout;
-       memset(s, 0, sizeof(*s));
        memcpy(s->dst, dst, sizeof(s->dst));
 
        if (pinfo) {
index 7870e7bb0bacc033752366da5ccd31fdd9bfe890..5af8a59e1503c7d5a90cf332af72ee5921d94950 100644 (file)
@@ -148,11 +148,10 @@ static int tcindex_init(struct tcf_proto *tp)
        struct tcindex_data *p;
 
        DPRINTK("tcindex_init(tp %p)\n",tp);
-       p = kmalloc(sizeof(struct tcindex_data),GFP_KERNEL);
+       p = kzalloc(sizeof(struct tcindex_data),GFP_KERNEL);
        if (!p)
                return -ENOMEM;
 
-       memset(p, 0, sizeof(*p));
        p->mask = 0xffff;
        p->hash = DEFAULT_HASH_SIZE;
        p->fall_through = 1;
@@ -296,16 +295,14 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
        err = -ENOMEM;
        if (!cp.perfect && !cp.h) {
                if (valid_perfect_hash(&cp)) {
-                       cp.perfect = kmalloc(cp.hash * sizeof(*r), GFP_KERNEL);
+                       cp.perfect = kcalloc(cp.hash, sizeof(*r), GFP_KERNEL);
                        if (!cp.perfect)
                                goto errout;
-                       memset(cp.perfect, 0, cp.hash * sizeof(*r));
                        balloc = 1;
                } else {
-                       cp.h = kmalloc(cp.hash * sizeof(f), GFP_KERNEL);
+                       cp.h = kcalloc(cp.hash, sizeof(f), GFP_KERNEL);
                        if (!cp.h)
                                goto errout;
-                       memset(cp.h, 0, cp.hash * sizeof(f));
                        balloc = 2;
                }
        }
@@ -316,10 +313,9 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
                r = tcindex_lookup(&cp, handle) ? : &new_filter_result;
 
        if (r == &new_filter_result) {
-               f = kmalloc(sizeof(*f), GFP_KERNEL);
+               f = kzalloc(sizeof(*f), GFP_KERNEL);
                if (!f)
                        goto errout_alloc;
-               memset(f, 0, sizeof(*f));
        }
 
        if (tb[TCA_TCINDEX_CLASSID-1]) {
index d712edcd1bcfc36d591342c2f53dec718ee1dc84..eea3669667400868ccde06397175a6bf48fe50a5 100644 (file)
@@ -307,23 +307,21 @@ static int u32_init(struct tcf_proto *tp)
                if (tp_c->q == tp->q)
                        break;
 
-       root_ht = kmalloc(sizeof(*root_ht), GFP_KERNEL);
+       root_ht = kzalloc(sizeof(*root_ht), GFP_KERNEL);
        if (root_ht == NULL)
                return -ENOBUFS;
 
-       memset(root_ht, 0, sizeof(*root_ht));
        root_ht->divisor = 0;
        root_ht->refcnt++;
        root_ht->handle = tp_c ? gen_new_htid(tp_c) : 0x80000000;
        root_ht->prio = tp->prio;
 
        if (tp_c == NULL) {
-               tp_c = kmalloc(sizeof(*tp_c), GFP_KERNEL);
+               tp_c = kzalloc(sizeof(*tp_c), GFP_KERNEL);
                if (tp_c == NULL) {
                        kfree(root_ht);
                        return -ENOBUFS;
                }
-               memset(tp_c, 0, sizeof(*tp_c));
                tp_c->q = tp->q;
                tp_c->next = u32_list;
                u32_list = tp_c;
@@ -571,10 +569,9 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
                        if (handle == 0)
                                return -ENOMEM;
                }
-               ht = kmalloc(sizeof(*ht) + divisor*sizeof(void*), GFP_KERNEL);
+               ht = kzalloc(sizeof(*ht) + divisor*sizeof(void*), GFP_KERNEL);
                if (ht == NULL)
                        return -ENOBUFS;
-               memset(ht, 0, sizeof(*ht) + divisor*sizeof(void*));
                ht->tp_c = tp_c;
                ht->refcnt = 0;
                ht->divisor = divisor;
@@ -617,18 +614,16 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
 
        s = RTA_DATA(tb[TCA_U32_SEL-1]);
 
-       n = kmalloc(sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key), GFP_KERNEL);
+       n = kzalloc(sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key), GFP_KERNEL);
        if (n == NULL)
                return -ENOBUFS;
 
-       memset(n, 0, sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key));
 #ifdef CONFIG_CLS_U32_PERF
-       n->pf = kmalloc(sizeof(struct tc_u32_pcnt) + s->nkeys*sizeof(u64), GFP_KERNEL);
+       n->pf = kzalloc(sizeof(struct tc_u32_pcnt) + s->nkeys*sizeof(u64), GFP_KERNEL);
        if (n->pf == NULL) {
                kfree(n);
                return -ENOBUFS;
        }
-       memset(n->pf, 0, sizeof(struct tc_u32_pcnt) + s->nkeys*sizeof(u64));
 #endif
 
        memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key));
index 698372954f4db614e50b774467ce78788fa7d58b..61e3b740ab1a9b434cfc0a79955a5880e134826f 100644 (file)
@@ -773,10 +773,9 @@ static int em_meta_change(struct tcf_proto *tp, void *data, int len,
            TCF_META_ID(hdr->right.kind) > TCF_META_ID_MAX)
                goto errout;
 
-       meta = kmalloc(sizeof(*meta), GFP_KERNEL);
+       meta = kzalloc(sizeof(*meta), GFP_KERNEL);
        if (meta == NULL)
                goto errout;
-       memset(meta, 0, sizeof(*meta));
 
        memcpy(&meta->lvalue.hdr, &hdr->left, sizeof(hdr->left));
        memcpy(&meta->rvalue.hdr, &hdr->right, sizeof(hdr->right));
index 2405a86093a2eeed7d7ebbed7ce92b5d4527a062..0fd0768a17c6cc9ab5b627bbfd94bee9c03b9657 100644 (file)
@@ -321,10 +321,9 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct rtattr *rta,
        list_len = RTA_PAYLOAD(rt_list);
        matches_len = tree_hdr->nmatches * sizeof(*em);
 
-       tree->matches = kmalloc(matches_len, GFP_KERNEL);
+       tree->matches = kzalloc(matches_len, GFP_KERNEL);
        if (tree->matches == NULL)
                goto errout;
-       memset(tree->matches, 0, matches_len);
 
        /* We do not use rtattr_parse_nested here because the maximum
         * number of attributes is unknown. This saves us the allocation
index 5d3ae03e22a70fdf49350f833a282c0a3e12624a..0ebc98e9be2d81d5904a71da0cf2a24c01bf2615 100644 (file)
@@ -139,11 +139,10 @@ int qdisc_new_estimator(struct tc_stats *stats, spinlock_t *stats_lock, struct r
        if (parm->interval < -2 || parm->interval > 3)
                return -EINVAL;
 
-       est = kmalloc(sizeof(*est), GFP_KERNEL);
+       est = kzalloc(sizeof(*est), GFP_KERNEL);
        if (est == NULL)
                return -ENOBUFS;
 
-       memset(est, 0, sizeof(*est));
        est->interval = parm->interval + 2;
        est->stats = stats;
        est->stats_lock = stats_lock;
index 80b7f6a8d008e85f6c220ec0b3bc2624bef18d79..bac881bfe3628b24a36642c967f30543447fca39 100644 (file)
@@ -1926,10 +1926,9 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t
        }
 
        err = -ENOBUFS;
-       cl = kmalloc(sizeof(*cl), GFP_KERNEL);
+       cl = kzalloc(sizeof(*cl), GFP_KERNEL);
        if (cl == NULL)
                goto failure;
-       memset(cl, 0, sizeof(*cl));
        cl->R_tab = rtab;
        rtab = NULL;
        cl->refcnt = 1;
index d735f51686a19da66a22b0bf583e7cc81ec11c2f..0834c2ee917408286d3cf366645c6bd6b3e8fc43 100644 (file)
@@ -432,10 +432,9 @@ struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops)
        size = QDISC_ALIGN(sizeof(*sch));
        size += ops->priv_size + (QDISC_ALIGNTO - 1);
 
-       p = kmalloc(size, GFP_KERNEL);
+       p = kzalloc(size, GFP_KERNEL);
        if (!p)
                goto errout;
-       memset(p, 0, size);
        sch = (struct Qdisc *) QDISC_ALIGN((unsigned long) p);
        sch->padded = (char *) sch - (char *) p;
 
index 0cafdd5feb1bba315746c221ccb842485cd0ab84..18e81a8ffb012e5aab0b7b6b9d9f1d3965f803d3 100644 (file)
@@ -406,10 +406,9 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp,
        struct gred_sched_data *q;
 
        if (table->tab[dp] == NULL) {
-               table->tab[dp] = kmalloc(sizeof(*q), GFP_KERNEL);
+               table->tab[dp] = kzalloc(sizeof(*q), GFP_KERNEL);
                if (table->tab[dp] == NULL)
                        return -ENOMEM;
-               memset(table->tab[dp], 0, sizeof(*q));
        }
 
        q = table->tab[dp];
index 6b1b4a981e883bca03a22e457d478a27298626c3..6a6735a2ed355b9640e654b28a5ecb96f69906e8 100644 (file)
@@ -1123,10 +1123,9 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
        if (rsc == NULL && fsc == NULL)
                return -EINVAL;
 
-       cl = kmalloc(sizeof(struct hfsc_class), GFP_KERNEL);
+       cl = kzalloc(sizeof(struct hfsc_class), GFP_KERNEL);
        if (cl == NULL)
                return -ENOBUFS;
-       memset(cl, 0, sizeof(struct hfsc_class));
 
        if (rsc != NULL)
                hfsc_change_rsc(cl, rsc, 0);
index cc5f339e6f9121476197c3e659be9099f172e98b..880a3394a51fb6a6d093c54cb2318a58f6b7c38a 100644 (file)
@@ -1559,10 +1559,9 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                        goto failure;
                }
                err = -ENOBUFS;
-               if ((cl = kmalloc(sizeof(*cl), GFP_KERNEL)) == NULL)
+               if ((cl = kzalloc(sizeof(*cl), GFP_KERNEL)) == NULL)
                        goto failure;
                
-               memset(cl, 0, sizeof(*cl));
                cl->refcnt = 1;
                INIT_LIST_HEAD(&cl->sibling);
                INIT_LIST_HEAD(&cl->hlist);
index c5bd8064e6d81e68ff1a1b41ffca80ede3778fa1..a08ec4c7c55d7cfc0889d48bf5d001f483ffad4c 100644 (file)
@@ -148,7 +148,8 @@ static long tabledist(unsigned long mu, long sigma,
 static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
        struct netem_sched_data *q = qdisc_priv(sch);
-       struct netem_skb_cb *cb = (struct netem_skb_cb *)skb->cb;
+       /* We don't fill cb now as skb_unshare() may invalidate it */
+       struct netem_skb_cb *cb;
        struct sk_buff *skb2;
        int ret;
        int count = 1;
@@ -200,6 +201,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8);
        }
 
+       cb = (struct netem_skb_cb *)skb->cb;
        if (q->gap == 0                 /* not doing reordering */
            || q->counter < q->gap      /* inside last reordering gap */
            || q->reorder < get_crandom(&q->reorder_cor)) {
index 9d05e13e92f69c8f276db2f8a53bed71988ff1ea..27329ce9c311dc8aaf74c020911fb3d026aeab74 100644 (file)
@@ -441,7 +441,8 @@ void sctp_assoc_set_primary(struct sctp_association *asoc,
        /* If the primary path is changing, assume that the
         * user wants to use this new path.
         */
-       if (transport->state != SCTP_INACTIVE)
+       if ((transport->state == SCTP_ACTIVE) ||
+           (transport->state == SCTP_UNKNOWN))
                asoc->peer.active_path = transport;
 
        /*
@@ -532,11 +533,11 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
        port = addr->v4.sin_port;
 
        SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_add_peer:association %p addr: ",
-                                " port: %d state:%s\n",
+                                " port: %d state:%d\n",
                                 asoc,
                                 addr,
                                 addr->v4.sin_port,
-                                peer_state == SCTP_UNKNOWN?"UNKNOWN":"ACTIVE");
+                                peer_state);
 
        /* Set the port if it has not been set yet.  */
        if (0 == asoc->peer.port)
@@ -545,9 +546,12 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
        /* Check to see if this is a duplicate. */
        peer = sctp_assoc_lookup_paddr(asoc, addr);
        if (peer) {
-               if (peer_state == SCTP_ACTIVE &&
-                   peer->state == SCTP_UNKNOWN)
-                    peer->state = SCTP_ACTIVE;
+               if (peer->state == SCTP_UNKNOWN) {
+                       if (peer_state == SCTP_ACTIVE)
+                               peer->state = SCTP_ACTIVE;
+                       if (peer_state == SCTP_UNCONFIRMED)
+                               peer->state = SCTP_UNCONFIRMED;
+               }
                return peer;
        }
 
@@ -739,7 +743,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
        list_for_each(pos, &asoc->peer.transport_addr_list) {
                t = list_entry(pos, struct sctp_transport, transports);
 
-               if (t->state == SCTP_INACTIVE)
+               if ((t->state == SCTP_INACTIVE) ||
+                   (t->state == SCTP_UNCONFIRMED))
                        continue;
                if (!first || t->last_time_heard > first->last_time_heard) {
                        second = first;
@@ -759,7 +764,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
         * [If the primary is active but not most recent, bump the most
         * recently used transport.]
         */
-       if (asoc->peer.primary_path->state != SCTP_INACTIVE &&
+       if (((asoc->peer.primary_path->state == SCTP_ACTIVE) ||
+            (asoc->peer.primary_path->state == SCTP_UNKNOWN)) &&
            first != asoc->peer.primary_path) {
                second = first;
                first = asoc->peer.primary_path;
@@ -1054,7 +1060,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
                                           transports);
                        if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr))
                                sctp_assoc_add_peer(asoc, &trans->ipaddr,
-                                                   GFP_ATOMIC, SCTP_ACTIVE);
+                                                   GFP_ATOMIC, trans->state);
                }
 
                asoc->ctsn_ack_point = asoc->next_tsn - 1;
@@ -1094,7 +1100,8 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
 
                /* Try to find an active transport. */
 
-               if (t->state != SCTP_INACTIVE) {
+               if ((t->state == SCTP_ACTIVE) ||
+                   (t->state == SCTP_UNKNOWN)) {
                        break;
                } else {
                        /* Keep track of the next transport in case
index 2b962627f631390ebe3af403b7915d27080d8808..2b9c12a170e55584bef8cf5335abe2aa06309642 100644 (file)
@@ -146,7 +146,7 @@ void sctp_bind_addr_free(struct sctp_bind_addr *bp)
 
 /* Add an address to the bind address list in the SCTP_bind_addr structure. */
 int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
-                      gfp_t gfp)
+                      __u8 use_as_src, gfp_t gfp)
 {
        struct sctp_sockaddr_entry *addr;
 
@@ -163,6 +163,8 @@ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
        if (!addr->a.v4.sin_port)
                addr->a.v4.sin_port = bp->port;
 
+       addr->use_as_src = use_as_src;
+
        INIT_LIST_HEAD(&addr->list);
        list_add_tail(&addr->list, &bp->address_list);
        SCTP_DBG_OBJCNT_INC(addr);
@@ -274,7 +276,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
                }
 
                af->from_addr_param(&addr, rawaddr, port, 0);
-               retval = sctp_add_bind_addr(bp, &addr, gfp);
+               retval = sctp_add_bind_addr(bp, &addr, 1, gfp);
                if (retval) {
                        /* Can't finish building the list, clean up. */
                        sctp_bind_addr_clean(bp);
@@ -367,7 +369,7 @@ static int sctp_copy_one_addr(struct sctp_bind_addr *dest,
                    (((AF_INET6 == addr->sa.sa_family) &&
                      (flags & SCTP_ADDR6_ALLOWED) &&
                      (flags & SCTP_ADDR6_PEERSUPP))))
-                       error = sctp_add_bind_addr(dest, addr, gfp);
+                       error = sctp_add_bind_addr(dest, addr, 1, gfp);
        }
 
        return error;
index 67bd53070ee0b31d0babb2221ccd57e03f81124b..ffda1d680529c4cb4c9fc6b7a478097e44983f54 100644 (file)
@@ -158,6 +158,12 @@ void sctp_endpoint_add_asoc(struct sctp_endpoint *ep,
 void sctp_endpoint_free(struct sctp_endpoint *ep)
 {
        ep->base.dead = 1;
+
+       ep->base.sk->sk_state = SCTP_SS_CLOSED;
+
+       /* Unlink this endpoint, so we can't find it again! */
+       sctp_unhash_endpoint(ep);
+
        sctp_endpoint_put(ep);
 }
 
@@ -166,11 +172,6 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
 {
        SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return);
 
-       ep->base.sk->sk_state = SCTP_SS_CLOSED;
-
-       /* Unlink this endpoint, so we can't find it again! */
-       sctp_unhash_endpoint(ep);
-
        /* Free up the HMAC transform. */
        sctp_crypto_free_tfm(sctp_sk(ep->base.sk)->hmac);
 
index 8ef08070c8b679b4702b922181b0186691335bfd..99c0cefc04e072ff49b1b794777d7cb904a6cd95 100644 (file)
@@ -290,7 +290,8 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
        sctp_read_lock(addr_lock);
        list_for_each(pos, &bp->address_list) {
                laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
-               if ((laddr->a.sa.sa_family == AF_INET6) &&
+               if ((laddr->use_as_src) &&
+                   (laddr->a.sa.sa_family == AF_INET6) &&
                    (scope <= sctp_scope(&laddr->a))) {
                        bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a);
                        if (!baddr || (matchlen < bmatchlen)) {
index e5faa351aaadeffd1f1b5a2bc1636c39384d0cae..30b710c54e6492aeb6733973790483472fed2076 100644 (file)
@@ -691,7 +691,8 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
 
                if (!new_transport) {
                        new_transport = asoc->peer.active_path;
-               } else if (new_transport->state == SCTP_INACTIVE) {
+               } else if ((new_transport->state == SCTP_INACTIVE) ||
+                          (new_transport->state == SCTP_UNCONFIRMED)) {
                        /* If the chunk is Heartbeat or Heartbeat Ack,
                         * send it to chunk->transport, even if it's
                         * inactive.
@@ -848,7 +849,8 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
                         */
                        new_transport = chunk->transport;
                        if (!new_transport ||
-                           new_transport->state == SCTP_INACTIVE)
+                           ((new_transport->state == SCTP_INACTIVE) ||
+                            (new_transport->state == SCTP_UNCONFIRMED)))
                                new_transport = asoc->peer.active_path;
 
                        /* Change packets if necessary.  */
@@ -1464,7 +1466,8 @@ static void sctp_check_transmitted(struct sctp_outq *q,
                        /* Mark the destination transport address as
                         * active if it is not so marked.
                         */
-                       if (transport->state == SCTP_INACTIVE) {
+                       if ((transport->state == SCTP_INACTIVE) ||
+                           (transport->state == SCTP_UNCONFIRMED)) {
                                sctp_assoc_control_transport(
                                        transport->asoc,
                                        transport,
index 816c033d78865464a8826c8ab2ae102b633a2e31..1ab03a27a76e76f99d8986a45ea8b05ea04cb4c9 100644 (file)
@@ -240,7 +240,7 @@ int sctp_copy_local_addr_list(struct sctp_bind_addr *bp, sctp_scope_t scope,
                            (((AF_INET6 == addr->a.sa.sa_family) &&
                              (copy_flags & SCTP_ADDR6_ALLOWED) &&
                              (copy_flags & SCTP_ADDR6_PEERSUPP)))) {
-                               error = sctp_add_bind_addr(bp, &addr->a, 
+                               error = sctp_add_bind_addr(bp, &addr->a, 1,
                                                           GFP_ATOMIC);
                                if (error)
                                        goto end_copy;
@@ -486,6 +486,8 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
                list_for_each(pos, &bp->address_list) {
                        laddr = list_entry(pos, struct sctp_sockaddr_entry,
                                           list);
+                       if (!laddr->use_as_src)
+                               continue;
                        sctp_v4_dst_saddr(&dst_saddr, dst, bp->port);
                        if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a))
                                goto out_unlock;
@@ -506,7 +508,8 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
        list_for_each(pos, &bp->address_list) {
                laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
 
-               if (AF_INET == laddr->a.sa.sa_family) {
+               if ((laddr->use_as_src) &&
+                   (AF_INET == laddr->a.sa.sa_family)) {
                        fl.fl4_src = laddr->a.v4.sin_addr.s_addr;
                        if (!ip_route_output_key(&rt, &fl)) {
                                dst = &rt->u.dst;
index 2a8773691695243fe6b4901f4b3a7f3328b78665..4f11f5858209b22d67b2237a3957fb0f6cab1ff5 100644 (file)
@@ -1493,7 +1493,7 @@ no_hmac:
 
        /* Also, add the destination address. */
        if (list_empty(&retval->base.bind_addr.address_list)) {
-               sctp_add_bind_addr(&retval->base.bind_addr, &chunk->dest,
+               sctp_add_bind_addr(&retval->base.bind_addr, &chunk->dest, 1,
                                   GFP_ATOMIC);
        }
 
@@ -2017,7 +2017,7 @@ static int sctp_process_param(struct sctp_association *asoc,
                af->from_addr_param(&addr, param.addr, asoc->peer.port, 0);
                scope = sctp_scope(peer_addr);
                if (sctp_in_scope(&addr, scope))
-                       if (!sctp_assoc_add_peer(asoc, &addr, gfp, SCTP_ACTIVE))
+                       if (!sctp_assoc_add_peer(asoc, &addr, gfp, SCTP_UNCONFIRMED))
                                return 0;
                break;
 
@@ -2418,7 +2418,7 @@ static __u16 sctp_process_asconf_param(struct sctp_association *asoc,
                 * Due to Resource Shortage'.
                 */
 
-               peer = sctp_assoc_add_peer(asoc, &addr, GFP_ATOMIC, SCTP_ACTIVE);
+               peer = sctp_assoc_add_peer(asoc, &addr, GFP_ATOMIC, SCTP_UNCONFIRMED);
                if (!peer)
                        return SCTP_ERROR_RSRC_LOW;
 
@@ -2565,6 +2565,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
        union sctp_addr_param *addr_param;
        struct list_head *pos;
        struct sctp_transport *transport;
+       struct sctp_sockaddr_entry *saddr;
        int retval = 0;
 
        addr_param = (union sctp_addr_param *)
@@ -2578,7 +2579,11 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
        case SCTP_PARAM_ADD_IP:
                sctp_local_bh_disable();
                sctp_write_lock(&asoc->base.addr_lock);
-               retval = sctp_add_bind_addr(bp, &addr, GFP_ATOMIC);
+               list_for_each(pos, &bp->address_list) {
+                       saddr = list_entry(pos, struct sctp_sockaddr_entry, list);
+                       if (sctp_cmp_addr_exact(&saddr->a, &addr))
+                               saddr->use_as_src = 1;
+               }
                sctp_write_unlock(&asoc->base.addr_lock);
                sctp_local_bh_enable();
                break;
@@ -2591,6 +2596,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
                list_for_each(pos, &asoc->peer.transport_addr_list) {
                        transport = list_entry(pos, struct sctp_transport,
                                                 transports);
+                       dst_release(transport->dst);
                        sctp_transport_route(transport, NULL,
                                             sctp_sk(asoc->base.sk));
                }
index c5beb2ad7ef7a442798a669faea2c393d5f422f8..9c10bdec1afe7d2f9d6a8f02d1cbd94a9db738b2 100644 (file)
@@ -430,7 +430,11 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
        /* The check for association's overall error counter exceeding the
         * threshold is done in the state function.
         */
-       asoc->overall_error_count++;
+       /* When probing UNCONFIRMED addresses, the association overall
+        * error count is NOT incremented
+        */
+       if (transport->state != SCTP_UNCONFIRMED)
+               asoc->overall_error_count++;
 
        if (transport->state != SCTP_INACTIVE &&
            (transport->error_count++ >= transport->pathmaxrxt)) {
@@ -610,7 +614,7 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
        /* Mark the destination transport address as active if it is not so
         * marked.
         */
-       if (t->state == SCTP_INACTIVE)
+       if ((t->state == SCTP_INACTIVE) || (t->state == SCTP_UNCONFIRMED))
                sctp_assoc_control_transport(asoc, t, SCTP_TRANSPORT_UP,
                                             SCTP_HEARTBEAT_SUCCESS);
 
@@ -620,6 +624,10 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
         */
        hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data;
        sctp_transport_update_rto(t, (jiffies - hbinfo->sent_at));
+
+       /* Update the heartbeat timer.  */
+       if (!mod_timer(&t->hb_timer, sctp_transport_timeout(t)))
+               sctp_transport_hold(t);
 }
 
 /* Helper function to do a transport reset at the expiry of the hearbeat
index 9e58144f4851129b7b9c6465c597a3a00bea0b46..ead3f1b0ea3dad20e0844cc3b21be2ac2d75fa9e 100644 (file)
@@ -846,6 +846,7 @@ static sctp_disposition_t sctp_sf_heartbeat(const struct sctp_endpoint *ep,
        hbinfo.param_hdr.length = htons(sizeof(sctp_sender_hb_info_t));
        hbinfo.daddr = transport->ipaddr;
        hbinfo.sent_at = jiffies;
+       hbinfo.hb_nonce = transport->hb_nonce;
 
        /* Send a heartbeat to our peer.  */
        paylen = sizeof(sctp_sender_hb_info_t);
@@ -1048,6 +1049,10 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
                return SCTP_DISPOSITION_DISCARD;
        }
 
+       /* Validate the 64-bit random nonce. */
+       if (hbinfo->hb_nonce != link->hb_nonce)
+               return SCTP_DISPOSITION_DISCARD;
+
        max_interval = link->hbinterval + link->rto;
 
        /* Check if the timestamp looks valid.  */
@@ -5278,7 +5283,6 @@ static int sctp_eat_data(const struct sctp_association *asoc,
        datalen -= sizeof(sctp_data_chunk_t);
 
        deliver = SCTP_CMD_CHUNK_ULP;
-       chunk->data_accepted = 1;
 
        /* Think about partial delivery. */
        if ((datalen >= asoc->rwnd) && (!asoc->ulpq.pd_mode)) {
@@ -5357,6 +5361,8 @@ static int sctp_eat_data(const struct sctp_association *asoc,
        if (SCTP_CMD_CHUNK_ULP == deliver)
                sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn));
 
+       chunk->data_accepted = 1;
+
        /* Note: Some chunks may get overcounted (if we drop) or overcounted
         * if we renege and the chunk arrives again.
         */
index 0a2c71d0d8aad858eb3408591c1af594d1d51587..54722e622e6dbf68d44be8f82cdb01f72ab7b558 100644 (file)
@@ -369,7 +369,7 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
 
        /* Use GFP_ATOMIC since BHs are disabled.  */
        addr->v4.sin_port = ntohs(addr->v4.sin_port);
-       ret = sctp_add_bind_addr(bp, addr, GFP_ATOMIC);
+       ret = sctp_add_bind_addr(bp, addr, 1, GFP_ATOMIC);
        addr->v4.sin_port = htons(addr->v4.sin_port);
        sctp_write_unlock(&ep->base.addr_lock);
        sctp_local_bh_enable();
@@ -491,6 +491,7 @@ static int sctp_send_asconf_add_ip(struct sock              *sk,
        struct sctp_chunk               *chunk;
        struct sctp_sockaddr_entry      *laddr;
        union sctp_addr                 *addr;
+       union sctp_addr                 saveaddr;
        void                            *addr_buf;
        struct sctp_af                  *af;
        struct list_head                *pos;
@@ -558,14 +559,26 @@ static int sctp_send_asconf_add_ip(struct sock            *sk,
                }
 
                retval = sctp_send_asconf(asoc, chunk);
+               if (retval)
+                       goto out;
 
-               /* FIXME: After sending the add address ASCONF chunk, we
-                * cannot append the address to the association's binding
-                * address list, because the new address may be used as the
-                * source of a message sent to the peer before the ASCONF
-                * chunk is received by the peer.  So we should wait until
-                * ASCONF_ACK is received.
+               /* Add the new addresses to the bind address list with
+                * use_as_src set to 0.
                 */
+               sctp_local_bh_disable();
+               sctp_write_lock(&asoc->base.addr_lock);
+               addr_buf = addrs;
+               for (i = 0; i < addrcnt; i++) {
+                       addr = (union sctp_addr *)addr_buf;
+                       af = sctp_get_af_specific(addr->v4.sin_family);
+                       memcpy(&saveaddr, addr, af->sockaddr_len);
+                       saveaddr.v4.sin_port = ntohs(saveaddr.v4.sin_port);
+                       retval = sctp_add_bind_addr(bp, &saveaddr, 0,
+                                                   GFP_ATOMIC);
+                       addr_buf += af->sockaddr_len;
+               }
+               sctp_write_unlock(&asoc->base.addr_lock);
+               sctp_local_bh_enable();
        }
 
 out:
@@ -676,12 +689,15 @@ static int sctp_send_asconf_del_ip(struct sock            *sk,
        struct sctp_sock        *sp;
        struct sctp_endpoint    *ep;
        struct sctp_association *asoc;
+       struct sctp_transport   *transport;
        struct sctp_bind_addr   *bp;
        struct sctp_chunk       *chunk;
        union sctp_addr         *laddr;
+       union sctp_addr         saveaddr;
        void                    *addr_buf;
        struct sctp_af          *af;
-       struct list_head        *pos;
+       struct list_head        *pos, *pos1;
+       struct sctp_sockaddr_entry *saddr;
        int                     i;
        int                     retval = 0;
 
@@ -748,14 +764,42 @@ static int sctp_send_asconf_del_ip(struct sock            *sk,
                        goto out;
                }
 
-               retval = sctp_send_asconf(asoc, chunk);
+               /* Reset use_as_src flag for the addresses in the bind address
+                * list that are to be deleted.
+                */
+               sctp_local_bh_disable();
+               sctp_write_lock(&asoc->base.addr_lock);
+               addr_buf = addrs;
+               for (i = 0; i < addrcnt; i++) {
+                       laddr = (union sctp_addr *)addr_buf;
+                       af = sctp_get_af_specific(laddr->v4.sin_family);
+                       memcpy(&saveaddr, laddr, af->sockaddr_len);
+                       saveaddr.v4.sin_port = ntohs(saveaddr.v4.sin_port);
+                       list_for_each(pos1, &bp->address_list) {
+                               saddr = list_entry(pos1,
+                                                  struct sctp_sockaddr_entry,
+                                                  list);
+                               if (sctp_cmp_addr_exact(&saddr->a, &saveaddr))
+                                       saddr->use_as_src = 0;
+                       }
+                       addr_buf += af->sockaddr_len;
+               }
+               sctp_write_unlock(&asoc->base.addr_lock);
+               sctp_local_bh_enable();
 
-               /* FIXME: After sending the delete address ASCONF chunk, we
-                * cannot remove the addresses from the association's bind
-                * address list, because there maybe some packet send to
-                * the delete addresses, so we should wait until ASCONF_ACK
-                * packet is received.
+               /* Update the route and saddr entries for all the transports
+                * as some of the addresses in the bind address list are
+                * about to be deleted and cannot be used as source addresses.
                 */
+               list_for_each(pos1, &asoc->peer.transport_addr_list) {
+                       transport = list_entry(pos1, struct sctp_transport,
+                                              transports);
+                       dst_release(transport->dst);
+                       sctp_transport_route(transport, NULL,
+                                            sctp_sk(asoc->base.sk));
+               }
+
+               retval = sctp_send_asconf(asoc, chunk);
        }
 out:
        return retval;
@@ -4977,7 +5021,7 @@ static struct sctp_bind_bucket *sctp_bucket_create(
 /* Caller must hold hashbucket lock for this tb with local BH disabled */
 static void sctp_bucket_destroy(struct sctp_bind_bucket *pp)
 {
-       if (hlist_empty(&pp->owner)) {
+       if (pp && hlist_empty(&pp->owner)) {
                if (pp->next)
                        pp->next->pprev = pp->pprev;
                *(pp->pprev) = pp->next;
index 160f62ad1cc55f924e7fc591e7df3a7259f5376a..2763aa93de1af40ced0919b8656e47ae54c1891c 100644 (file)
@@ -49,6 +49,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/random.h>
 #include <net/sctp/sctp.h>
 #include <net/sctp/sm.h>
 
@@ -85,7 +86,6 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
 
        peer->init_sent_count = 0;
 
-       peer->state = SCTP_ACTIVE;
        peer->param_flags = SPP_HB_DISABLE |
                            SPP_PMTUD_ENABLE |
                            SPP_SACKDELAY_ENABLE;
@@ -109,6 +109,9 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
        peer->hb_timer.function = sctp_generate_heartbeat_event;
        peer->hb_timer.data = (unsigned long)peer;
 
+       /* Initialize the 64-bit random nonce sent with heartbeat. */
+       get_random_bytes(&peer->hb_nonce, sizeof(peer->hb_nonce));
+
        atomic_set(&peer->refcnt, 1);
        peer->dead = 0;
 
@@ -517,7 +520,9 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
 unsigned long sctp_transport_timeout(struct sctp_transport *t)
 {
        unsigned long timeout;
-       timeout = t->hbinterval + t->rto + sctp_jitter(t->rto);
+       timeout = t->rto + sctp_jitter(t->rto);
+       if (t->state != SCTP_UNCONFIRMED)
+               timeout += t->hbinterval;
        timeout += jiffies;
        return timeout;
 }
index 519ebc17c02845a762102c00b35efb6f01b73b46..4a9aa9393b975eb138b0853029695c325aecb4f4 100644 (file)
@@ -225,9 +225,8 @@ gss_alloc_context(void)
 {
        struct gss_cl_ctx *ctx;
 
-       ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
+       ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
        if (ctx != NULL) {
-               memset(ctx, 0, sizeof(*ctx));
                ctx->gc_proc = RPC_GSS_PROC_DATA;
                ctx->gc_seq = 1;        /* NetApp 6.4R1 doesn't accept seq. no. 0 */
                spin_lock_init(&ctx->gc_seq_lock);
@@ -391,9 +390,8 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid)
 {
        struct gss_upcall_msg *gss_msg;
 
-       gss_msg = kmalloc(sizeof(*gss_msg), GFP_KERNEL);
+       gss_msg = kzalloc(sizeof(*gss_msg), GFP_KERNEL);
        if (gss_msg != NULL) {
-               memset(gss_msg, 0, sizeof(*gss_msg));
                INIT_LIST_HEAD(&gss_msg->list);
                rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq");
                init_waitqueue_head(&gss_msg->waitqueue);
@@ -776,10 +774,9 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
        dprintk("RPC:      gss_create_cred for uid %d, flavor %d\n",
                acred->uid, auth->au_flavor);
 
-       if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL)))
+       if (!(cred = kzalloc(sizeof(*cred), GFP_KERNEL)))
                goto out_err;
 
-       memset(cred, 0, sizeof(*cred));
        atomic_set(&cred->gc_count, 1);
        cred->gc_uid = acred->uid;
        /*
index b8714a87b34ccc24365ad772df0b27273d246c1e..70e1e53a632b1120ca8913fbec39a67a97455ae4 100644 (file)
@@ -129,9 +129,8 @@ gss_import_sec_context_kerberos(const void *p,
        const void *end = (const void *)((const char *)p + len);
        struct  krb5_ctx *ctx;
 
-       if (!(ctx = kmalloc(sizeof(*ctx), GFP_KERNEL)))
+       if (!(ctx = kzalloc(sizeof(*ctx), GFP_KERNEL)))
                goto out_err;
-       memset(ctx, 0, sizeof(*ctx));
 
        p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate));
        if (IS_ERR(p))
index d88468d21c3783ebecc6bf0f25fbf835854fcf42..3db745379d060a0d3e0a653636223e3d7d460ab4 100644 (file)
@@ -237,9 +237,8 @@ gss_import_sec_context(const void *input_token, size_t bufsize,
                       struct gss_api_mech      *mech,
                       struct gss_ctx           **ctx_id)
 {
-       if (!(*ctx_id = kmalloc(sizeof(**ctx_id), GFP_KERNEL)))
+       if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL)))
                return GSS_S_FAILURE;
-       memset(*ctx_id, 0, sizeof(**ctx_id));
        (*ctx_id)->mech_type = gss_mech_get(mech);
 
        return mech->gm_ops
index 3d0432aa45c1363c4745668efcde7721f4e8532c..88dcb52d171b653a797d3a0a579570d5223e8238 100644 (file)
@@ -152,9 +152,8 @@ gss_import_sec_context_spkm3(const void *p, size_t len,
        const void *end = (const void *)((const char *)p + len);
        struct  spkm3_ctx *ctx;
 
-       if (!(ctx = kmalloc(sizeof(*ctx), GFP_KERNEL)))
+       if (!(ctx = kzalloc(sizeof(*ctx), GFP_KERNEL)))
                goto out_err;
-       memset(ctx, 0, sizeof(*ctx));
 
        p = simple_get_netobj(p, end, &ctx->ctx_id);
        if (IS_ERR(p))
index af0d7ce7468682cfe6d6324e8a2a7a220d64698f..854a983ccf26fd7c5fbc7c9e439bbae19ad31b70 100644 (file)
@@ -90,10 +90,9 @@ asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits)
 int
 decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen)
 {
-       if (!(out->data = kmalloc(explen,GFP_KERNEL)))
+       if (!(out->data = kzalloc(explen,GFP_KERNEL)))
                return 0;
        out->len = explen;
-       memset(out->data, 0, explen);
        memcpy(out->data, in, enclen);
        return 1;
 }
index aa8965e9d30770cec269d1dfe6cd0bccb490dfa1..4ba271f892c8791714e635f91f32d50eb1dbd32d 100644 (file)
@@ -125,10 +125,9 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
                goto out_err;
 
        err = -ENOMEM;
-       clnt = kmalloc(sizeof(*clnt), GFP_KERNEL);
+       clnt = kzalloc(sizeof(*clnt), GFP_KERNEL);
        if (!clnt)
                goto out_err;
-       memset(clnt, 0, sizeof(*clnt));
        atomic_set(&clnt->cl_users, 0);
        atomic_set(&clnt->cl_count, 1);
        clnt->cl_parent = clnt;
index 15c2db26767bc5e5b6848d904078c9b0975dcfa4..bd98124c3a649b97508685cd2f87b4813aeb83b7 100644 (file)
@@ -114,13 +114,8 @@ void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp) {
  */
 struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt)
 {
-       unsigned int ops = clnt->cl_maxproc;
-       size_t size = ops * sizeof(struct rpc_iostats);
        struct rpc_iostats *new;
-
-       new = kmalloc(size, GFP_KERNEL);
-       if (new)
-               memset(new, 0 , size);
+       new = kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL);
        return new;
 }
 EXPORT_SYMBOL(rpc_alloc_iostats);
index 01ba60a4957260601322fd261e5bafc81dfc200c..b76a227dd3ad9aac842f988874bc66cbb27e4a7b 100644 (file)
@@ -32,9 +32,8 @@ svc_create(struct svc_program *prog, unsigned int bufsize)
        int vers;
        unsigned int xdrsize;
 
-       if (!(serv = kmalloc(sizeof(*serv), GFP_KERNEL)))
+       if (!(serv = kzalloc(sizeof(*serv), GFP_KERNEL)))
                return NULL;
-       memset(serv, 0, sizeof(*serv));
        serv->sv_name      = prog->pg_name;
        serv->sv_program   = prog;
        serv->sv_nrthreads = 1;
@@ -159,11 +158,10 @@ svc_create_thread(svc_thread_fn func, struct svc_serv *serv)
        struct svc_rqst *rqstp;
        int             error = -ENOMEM;
 
-       rqstp = kmalloc(sizeof(*rqstp), GFP_KERNEL);
+       rqstp = kzalloc(sizeof(*rqstp), GFP_KERNEL);
        if (!rqstp)
                goto out;
 
-       memset(rqstp, 0, sizeof(*rqstp));
        init_waitqueue_head(&rqstp->rq_wait);
 
        if (!(rqstp->rq_argp = kmalloc(serv->sv_xdrsize, GFP_KERNEL))
index a27905a0ad277a4322d291e333c479794e3383de..d9a95732df46aabb6c8d9801d6e7d179b6618ca7 100644 (file)
@@ -1322,11 +1322,10 @@ svc_setup_socket(struct svc_serv *serv, struct socket *sock,
        struct sock     *inet;
 
        dprintk("svc: svc_setup_socket %p\n", sock);
-       if (!(svsk = kmalloc(sizeof(*svsk), GFP_KERNEL))) {
+       if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) {
                *errp = -ENOMEM;
                return NULL;
        }
-       memset(svsk, 0, sizeof(*svsk));
 
        inet = sock->sk;
 
index 02060d0e7be8013c9e3bb4a982bb667095c1579d..313b68d892c644c82ea5eb79c84ed6a163c76355 100644 (file)
@@ -908,9 +908,8 @@ static struct rpc_xprt *xprt_setup(int proto, struct sockaddr_in *ap, struct rpc
        struct rpc_xprt *xprt;
        struct rpc_rqst *req;
 
-       if ((xprt = kmalloc(sizeof(struct rpc_xprt), GFP_KERNEL)) == NULL)
+       if ((xprt = kzalloc(sizeof(struct rpc_xprt), GFP_KERNEL)) == NULL)
                return ERR_PTR(-ENOMEM);
-       memset(xprt, 0, sizeof(*xprt)); /* Nnnngh! */
 
        xprt->addr = *ap;
 
index 21006b10910130d74d0ef89aed0623c4788e6061..ee678ed13b6f26ac61ce9016787b5fa76705b05d 100644 (file)
@@ -1276,10 +1276,9 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
 
        xprt->max_reqs = xprt_udp_slot_table_entries;
        slot_table_size = xprt->max_reqs * sizeof(xprt->slot[0]);
-       xprt->slot = kmalloc(slot_table_size, GFP_KERNEL);
+       xprt->slot = kzalloc(slot_table_size, GFP_KERNEL);
        if (xprt->slot == NULL)
                return -ENOMEM;
-       memset(xprt->slot, 0, slot_table_size);
 
        xprt->prot = IPPROTO_UDP;
        xprt->port = xs_get_random_port();
@@ -1318,10 +1317,9 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to)
 
        xprt->max_reqs = xprt_tcp_slot_table_entries;
        slot_table_size = xprt->max_reqs * sizeof(xprt->slot[0]);
-       xprt->slot = kmalloc(slot_table_size, GFP_KERNEL);
+       xprt->slot = kzalloc(slot_table_size, GFP_KERNEL);
        if (xprt->slot == NULL)
                return -ENOMEM;
-       memset(xprt->slot, 0, slot_table_size);
 
        xprt->prot = IPPROTO_TCP;
        xprt->port = xs_get_random_port();
index 7ef17a449cfdb33d696c19428430ab891c4c316c..75a5968c2139b92640f58cb961fafe01660b1d3f 100644 (file)
@@ -665,11 +665,9 @@ int tipc_bearer_init(void)
        int res;
 
        write_lock_bh(&tipc_net_lock);
-       tipc_bearers = kmalloc(MAX_BEARERS * sizeof(struct bearer), GFP_ATOMIC);
-       media_list = kmalloc(MAX_MEDIA * sizeof(struct media), GFP_ATOMIC);
+       tipc_bearers = kcalloc(MAX_BEARERS, sizeof(struct bearer), GFP_ATOMIC);
+       media_list = kcalloc(MAX_MEDIA, sizeof(struct media), GFP_ATOMIC);
        if (tipc_bearers && media_list) {
-               memset(tipc_bearers, 0, MAX_BEARERS * sizeof(struct bearer));
-               memset(media_list, 0, MAX_MEDIA * sizeof(struct media));
                res = TIPC_OK;
        } else {
                kfree(tipc_bearers);
index 1dcb6940e338b5476fa7f624e2a1c1892630f9e0..b46b5188a9fd77d01bebd8ed5c481b5b5e1fcfc9 100644 (file)
@@ -57,29 +57,25 @@ struct cluster *tipc_cltr_create(u32 addr)
        struct _zone *z_ptr;
        struct cluster *c_ptr;
        int max_nodes; 
-       int alloc;
 
-       c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC);
+       c_ptr = kzalloc(sizeof(*c_ptr), GFP_ATOMIC);
        if (c_ptr == NULL) {
                warn("Cluster creation failure, no memory\n");
                return NULL;
        }
-       memset(c_ptr, 0, sizeof(*c_ptr));
 
        c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
        if (in_own_cluster(addr))
                max_nodes = LOWEST_SLAVE + tipc_max_slaves;
        else
                max_nodes = tipc_max_nodes + 1;
-       alloc = sizeof(void *) * (max_nodes + 1);
 
-       c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC);
+       c_ptr->nodes = kcalloc(max_nodes + 1, sizeof(void*), GFP_ATOMIC);
        if (c_ptr->nodes == NULL) {
                warn("Cluster creation failure, no memory for node area\n");
                kfree(c_ptr);
                return NULL;
        }
-       memset(c_ptr->nodes, 0, alloc);
 
        if (in_own_cluster(addr))
                tipc_local_nodes = c_ptr->nodes;
index 2b84412031203c479d6418bc39965eb5ca36c2ce..ee94de92ae9916f9c53f3fcd7b46cb917005eba5 100644 (file)
@@ -295,7 +295,7 @@ struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
 {
        struct link_req *req;
 
-       req = (struct link_req *)kmalloc(sizeof(*req), GFP_ATOMIC);
+       req = kmalloc(sizeof(*req), GFP_ATOMIC);
        if (!req)
                return NULL;
 
index c10e18a49b96b99d56fb8a71900ced7bebf98da6..693f02eca6d68226966c02642b4396d013849d05 100644 (file)
@@ -417,12 +417,11 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
        struct tipc_msg *msg;
        char *if_name;
 
-       l_ptr = (struct link *)kmalloc(sizeof(*l_ptr), GFP_ATOMIC);
+       l_ptr = kzalloc(sizeof(*l_ptr), GFP_ATOMIC);
        if (!l_ptr) {
                warn("Link creation failed, no memory\n");
                return NULL;
        }
-       memset(l_ptr, 0, sizeof(*l_ptr));
 
        l_ptr->addr = peer;
        if_name = strchr(b_ptr->publ.name, ':') + 1;
index a6926ff07bcc3e2365d0424e30b721df1e455d21..049242ea5c38e88ce4394d100ba300194a5dde55 100644 (file)
@@ -117,14 +117,12 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
                                       u32 scope, u32 node, u32 port_ref,   
                                       u32 key)
 {
-       struct publication *publ =
-               (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC);
+       struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC);
        if (publ == NULL) {
                warn("Publication creation failure, no memory\n");
                return NULL;
        }
 
-       memset(publ, 0, sizeof(*publ));
        publ->type = type;
        publ->lower = lower;
        publ->upper = upper;
@@ -144,11 +142,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
 
 static struct sub_seq *tipc_subseq_alloc(u32 cnt)
 {
-       u32 sz = cnt * sizeof(struct sub_seq);
-       struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC);
-
-       if (sseq)
-               memset(sseq, 0, sz);
+       struct sub_seq *sseq = kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC);
        return sseq;
 }
 
@@ -160,8 +154,7 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt)
 
 static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
 {
-       struct name_seq *nseq = 
-               (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC);
+       struct name_seq *nseq = kzalloc(sizeof(*nseq), GFP_ATOMIC);
        struct sub_seq *sseq = tipc_subseq_alloc(1);
 
        if (!nseq || !sseq) {
@@ -171,7 +164,6 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea
                return NULL;
        }
 
-       memset(nseq, 0, sizeof(*nseq));
        spin_lock_init(&nseq->lock);
        nseq->type = type;
        nseq->sseqs = sseq;
@@ -1060,7 +1052,7 @@ int tipc_nametbl_init(void)
 {
        int array_size = sizeof(struct hlist_head) * tipc_nametbl_size;
 
-       table.types = (struct hlist_head *)kmalloc(array_size, GFP_ATOMIC);
+       table.types = kmalloc(array_size, GFP_ATOMIC);
        if (!table.types)
                return -ENOMEM;
 
index e5a359ab49308025f10a1c065cfffa23e7991a5f..a991bf8a7f7493db1ee39b1dc6d1e6fff7e862a1 100644 (file)
@@ -160,14 +160,11 @@ void tipc_net_send_external_routes(u32 dest)
 
 static int net_init(void)
 {
-       u32 sz = sizeof(struct _zone *) * (tipc_max_zones + 1);
-
        memset(&tipc_net, 0, sizeof(tipc_net));
-       tipc_net.zones = (struct _zone **)kmalloc(sz, GFP_ATOMIC);
+       tipc_net.zones = kcalloc(tipc_max_zones + 1, sizeof(struct _zone *), GFP_ATOMIC);
        if (!tipc_net.zones) {
                return -ENOMEM;
        }
-       memset(tipc_net.zones, 0, sz);
        return TIPC_OK;
 }
 
index 3251c8d8e53c3bcc401a13e53d6636d410b6b5d0..b9c8c6b9e94fdf87c931cdc3c409a373a8043bdc 100644 (file)
@@ -226,12 +226,11 @@ u32 tipc_createport_raw(void *usr_handle,
        struct tipc_msg *msg;
        u32 ref;
 
-       p_ptr = kmalloc(sizeof(*p_ptr), GFP_ATOMIC);
+       p_ptr = kzalloc(sizeof(*p_ptr), GFP_ATOMIC);
        if (!p_ptr) {
                warn("Port creation failed, no memory\n");
                return 0;
        }
-       memset(p_ptr, 0, sizeof(*p_ptr));
        ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock);
        if (!ref) {
                warn("Port creation failed, reference table exhausted\n");
@@ -1058,7 +1057,7 @@ int tipc_createport(u32 user_ref,
        struct port *p_ptr; 
        u32 ref;
 
-       up_ptr = (struct user_port *)kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
+       up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
        if (!up_ptr) {
                warn("Port creation failed, no memory\n");
                return -ENOMEM;
index 596d3c8ff75006a95545e9f1a9407bd5e6b9d062..e6d6ae22ea495065db2e5862c8ec41b95fda8661 100644 (file)
@@ -79,7 +79,7 @@ int tipc_ref_table_init(u32 requested_size, u32 start)
        while (sz < requested_size) {
                sz <<= 1;
        }
-       table = (struct reference *)vmalloc(sz * sizeof(struct reference));
+       table = vmalloc(sz * sizeof(*table));
        if (table == NULL)
                return -ENOMEM;
 
index e19b4bcd67ec2bf44b6a2e7f4186751984782c4b..c51600ba5f4a63cc0557e01cd2c0c6cd0c081fdf 100644 (file)
@@ -393,12 +393,11 @@ static void subscr_named_msg_event(void *usr_handle,
 
        /* Create subscriber object */
 
-       subscriber = kmalloc(sizeof(struct subscriber), GFP_ATOMIC);
+       subscriber = kzalloc(sizeof(struct subscriber), GFP_ATOMIC);
        if (subscriber == NULL) {
                warn("Subscriber rejected, no memory\n");
                return;
        }
-       memset(subscriber, 0, sizeof(struct subscriber));
        INIT_LIST_HEAD(&subscriber->subscription_list);
        INIT_LIST_HEAD(&subscriber->subscriber_list);
        subscriber->ref = tipc_ref_acquire(subscriber, &subscriber->lock);
index 1e3ae57c722872f2e2d74d28891ecb39d53d0f21..04d1b9be9c5197ccf4ec6c9c9a401985959d50a0 100644 (file)
@@ -82,9 +82,8 @@ static int reg_init(void)
        
        spin_lock_bh(&reg_lock);
        if (!users) {
-               users = (struct tipc_user *)kmalloc(USER_LIST_SIZE, GFP_ATOMIC);
+               users = kzalloc(USER_LIST_SIZE, GFP_ATOMIC);
                if (users) {
-                       memset(users, 0, USER_LIST_SIZE);
                        for (i = 1; i <= MAX_USERID; i++) {
                                users[i].next = i - 1;
                        }
index 316c4872ff5bd42b59b27cf6a56bcf58f6ea8430..f5b00ea2d5acb2cb77d46d7ec3c2265fe3c16700 100644 (file)
@@ -52,13 +52,12 @@ struct _zone *tipc_zone_create(u32 addr)
                return NULL;
        }
 
-       z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC);
+       z_ptr = kzalloc(sizeof(*z_ptr), GFP_ATOMIC);
        if (!z_ptr) {
                warn("Zone creation failed, insufficient memory\n");
                return NULL;
        }
 
-       memset(z_ptr, 0, sizeof(*z_ptr));
        z_num = tipc_zone(addr);
        z_ptr->addr = tipc_addr(z_num, 0, 0);
        tipc_net.zones[z_num] = z_ptr;
index f70475bfb62a1c19d9d2215dcf479e9381427a9f..6f2909279268aadd136f28a3c210e6533f2c92c7 100644 (file)
@@ -663,11 +663,10 @@ static int unix_autobind(struct socket *sock)
                goto out;
 
        err = -ENOMEM;
-       addr = kmalloc(sizeof(*addr) + sizeof(short) + 16, GFP_KERNEL);
+       addr = kzalloc(sizeof(*addr) + sizeof(short) + 16, GFP_KERNEL);
        if (!addr)
                goto out;
 
-       memset(addr, 0, sizeof(*addr) + sizeof(short) + 16);
        addr->name->sun_family = AF_UNIX;
        atomic_set(&addr->refcnt, 1);
 
index a690cf773b6ae5123002de6a11196cd2774f67a4..6f39faa1583280e61ebda1f364067bd4ff4b9efa 100644 (file)
@@ -370,12 +370,11 @@ static int wanpipe_listen_rcv (struct sk_buff *skb,  struct sock *sk)
          * used by the ioctl call to read call information
          * and to execute commands. 
          */    
-       if ((mbox_ptr = kmalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) {
+       if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) {
                wanpipe_kill_sock_irq (newsk);
                release_device(dev);            
                return -ENOMEM;
        }
-       memset(mbox_ptr, 0, sizeof(mbox_cmd_t));
        memcpy(mbox_ptr,skb->data,skb->len);
 
        /* Register the lcn on which incoming call came
@@ -507,11 +506,10 @@ static struct sock *wanpipe_alloc_socket(void)
        if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, &wanpipe_proto, 1)) == NULL)
                return NULL;
 
-       if ((wan_opt = kmalloc(sizeof(struct wanpipe_opt), GFP_ATOMIC)) == NULL) {
+       if ((wan_opt = kzalloc(sizeof(struct wanpipe_opt), GFP_ATOMIC)) == NULL) {
                sk_free(sk);
                return NULL;
        }
-       memset(wan_opt, 0x00, sizeof(struct wanpipe_opt));
 
        wp_sk(sk) = wan_opt;
 
@@ -2011,10 +2009,9 @@ static int set_ioctl_cmd (struct sock *sk, void *arg)
 
                dev_put(dev);
                
-               if ((mbox_ptr = kmalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL)
+               if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL)
                        return -ENOMEM;
 
-               memset(mbox_ptr, 0, sizeof(mbox_cmd_t));
                wp_sk(sk)->mbox = mbox_ptr;
 
                wanpipe_link_driver(dev,sk);
index ad8e8a797790713b0b04c621b3dba215715506ea..9479659277aeea861b7aafaa96a3f6d8823411b8 100644 (file)
@@ -642,18 +642,16 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
 
        if (cnf->config_id == WANCONFIG_MPPP) {
 #ifdef CONFIG_WANPIPE_MULTPPP
-               pppdev = kmalloc(sizeof(struct ppp_device), GFP_KERNEL);
+               pppdev = kzalloc(sizeof(struct ppp_device), GFP_KERNEL);
                err = -ENOBUFS;
                if (pppdev == NULL)
                        goto out;
-               memset(pppdev, 0, sizeof(struct ppp_device));
-               pppdev->dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
+               pppdev->dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
                if (pppdev->dev == NULL) {
                        kfree(pppdev);
                        err = -ENOBUFS;
                        goto out;
                }
-               memset(pppdev->dev, 0, sizeof(struct net_device));
                err = wandev->new_if(wandev, (struct net_device *)pppdev, cnf);
                dev = pppdev->dev;
 #else
@@ -663,11 +661,10 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
                goto out;
 #endif
        } else {
-               dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
+               dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
                err = -ENOBUFS;
                if (dev == NULL)
                        goto out;
-               memset(dev, 0, sizeof(struct net_device));
                err = wandev->new_if(wandev, dev, cnf);
        }
 
index 405b741dff4353048b5f385cc503e48d0075ed85..f35bc676128c1a1f5f836816b285fe59af3f070e 100644 (file)
@@ -307,10 +307,9 @@ struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp)
 {
        struct xfrm_policy *policy;
 
-       policy = kmalloc(sizeof(struct xfrm_policy), gfp);
+       policy = kzalloc(sizeof(struct xfrm_policy), gfp);
 
        if (policy) {
-               memset(policy, 0, sizeof(struct xfrm_policy));
                atomic_set(&policy->refcnt, 1);
                rwlock_init(&policy->lock);
                init_timer(&policy->timer);
index 43f00fc28a3d14e724ba70af6915c73680e28d0b..0021aad5db43ccc0d0356f2f5e4e28446c8b983a 100644 (file)
@@ -194,10 +194,9 @@ struct xfrm_state *xfrm_state_alloc(void)
 {
        struct xfrm_state *x;
 
-       x = kmalloc(sizeof(struct xfrm_state), GFP_ATOMIC);
+       x = kzalloc(sizeof(struct xfrm_state), GFP_ATOMIC);
 
        if (x) {
-               memset(x, 0, sizeof(struct xfrm_state));
                atomic_set(&x->refcnt, 1);
                atomic_set(&x->tunnel_users, 0);
                INIT_LIST_HEAD(&x->bydst);