Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 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 ...
This commit is contained in:
Коммит
12157a8d78
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,...");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,...");
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 *);
|
||||
|
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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__);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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]) {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче