Staging: Use kcalloc or kzalloc
Use kcalloc or kzalloc rather than the combination of kmalloc and memset. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x,y,flags; statement S; type T; @@ x = - kmalloc + kcalloc ( - y * sizeof(T), + y, sizeof(T), flags); if (x == NULL) S -memset(x, 0, y * sizeof(T)); @@ expression x,size,flags; statement S; @@ -x = kmalloc(size,flags); +x = kzalloc(size,flags); if (x == NULL) S -memset(x, 0, size); // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk>
This commit is contained in:
parent
b5a2104c98
commit
7a6cb0d549
49 changed files with 62 additions and 142 deletions
|
@ -260,12 +260,10 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display)
|
||||||
for (i_Count = 0; i_Count < 2; i_Count++) {
|
for (i_Count = 0; i_Count < 2; i_Count++) {
|
||||||
pci_vendor = i_ADDIDATADeviceID[i_Count];
|
pci_vendor = i_ADDIDATADeviceID[i_Count];
|
||||||
if (pcidev->vendor == pci_vendor) {
|
if (pcidev->vendor == pci_vendor) {
|
||||||
amcc = kmalloc(sizeof(*amcc), GFP_KERNEL);
|
amcc = kzalloc(sizeof(*amcc), GFP_KERNEL);
|
||||||
if (amcc == NULL)
|
if (amcc == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
memset(amcc, 0, sizeof(*amcc));
|
|
||||||
|
|
||||||
amcc->pcidev = pcidev;
|
amcc->pcidev = pcidev;
|
||||||
if (last)
|
if (last)
|
||||||
last->next = amcc;
|
last->next = amcc;
|
||||||
|
|
|
@ -253,12 +253,10 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display)
|
||||||
|
|
||||||
pci_for_each_dev(pcidev) {
|
pci_for_each_dev(pcidev) {
|
||||||
if (pcidev->vendor == pci_vendor) {
|
if (pcidev->vendor == pci_vendor) {
|
||||||
amcc = kmalloc(sizeof(*amcc), GFP_KERNEL);
|
amcc = kzalloc(sizeof(*amcc), GFP_KERNEL);
|
||||||
if (amcc == NULL)
|
if (amcc == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
memset(amcc, 0, sizeof(*amcc));
|
|
||||||
|
|
||||||
amcc->pcidev = pcidev;
|
amcc->pcidev = pcidev;
|
||||||
if (last) {
|
if (last) {
|
||||||
last->next = amcc;
|
last->next = amcc;
|
||||||
|
|
|
@ -73,14 +73,13 @@ static void pci_card_list_init(unsigned short pci_vendor, char display)
|
||||||
pcidev != NULL;
|
pcidev != NULL;
|
||||||
pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
|
pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
|
||||||
if (pcidev->vendor == pci_vendor) {
|
if (pcidev->vendor == pci_vendor) {
|
||||||
inova = kmalloc(sizeof(*inova), GFP_KERNEL);
|
inova = kzalloc(sizeof(*inova), GFP_KERNEL);
|
||||||
if (!inova) {
|
if (!inova) {
|
||||||
printk
|
printk
|
||||||
("icp_multi: pci_card_list_init: allocation failed\n");
|
("icp_multi: pci_card_list_init: allocation failed\n");
|
||||||
pci_dev_put(pcidev);
|
pci_dev_put(pcidev);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memset(inova, 0, sizeof(*inova));
|
|
||||||
|
|
||||||
inova->pcidev = pci_dev_get(pcidev);
|
inova->pcidev = pci_dev_get(pcidev);
|
||||||
if (last) {
|
if (last) {
|
||||||
|
|
|
@ -1245,14 +1245,11 @@ int pmem_setup(struct android_pmem_platform_data *pdata,
|
||||||
}
|
}
|
||||||
pmem[id].num_entries = pmem[id].size / PMEM_MIN_ALLOC;
|
pmem[id].num_entries = pmem[id].size / PMEM_MIN_ALLOC;
|
||||||
|
|
||||||
pmem[id].bitmap = kmalloc(pmem[id].num_entries *
|
pmem[id].bitmap = kcalloc(pmem[id].num_entries,
|
||||||
sizeof(struct pmem_bits), GFP_KERNEL);
|
sizeof(struct pmem_bits), GFP_KERNEL);
|
||||||
if (!pmem[id].bitmap)
|
if (!pmem[id].bitmap)
|
||||||
goto err_no_mem_for_metadata;
|
goto err_no_mem_for_metadata;
|
||||||
|
|
||||||
memset(pmem[id].bitmap, 0, sizeof(struct pmem_bits) *
|
|
||||||
pmem[id].num_entries);
|
|
||||||
|
|
||||||
for (i = sizeof(pmem[id].num_entries) * 8 - 1; i >= 0; i--) {
|
for (i = sizeof(pmem[id].num_entries) * 8 - 1; i >= 0; i--) {
|
||||||
if ((pmem[id].num_entries) & 1<<i) {
|
if ((pmem[id].num_entries) & 1<<i) {
|
||||||
PMEM_ORDER(id, index) = i;
|
PMEM_ORDER(id, index) = i;
|
||||||
|
|
|
@ -380,13 +380,12 @@ static int gen_mjpeghdr_to_package(struct go7007 *go, __le16 *code, int space)
|
||||||
unsigned int addr = 0x19;
|
unsigned int addr = 0x19;
|
||||||
int size = 0, i, off = 0, chunk;
|
int size = 0, i, off = 0, chunk;
|
||||||
|
|
||||||
buf = kmalloc(4096, GFP_KERNEL);
|
buf = kzalloc(4096, GFP_KERNEL);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
printk(KERN_ERR "go7007: unable to allocate 4096 bytes for "
|
printk(KERN_ERR "go7007: unable to allocate 4096 bytes for "
|
||||||
"firmware construction\n");
|
"firmware construction\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(buf, 0, 4096);
|
|
||||||
|
|
||||||
for (i = 1; i < 32; ++i) {
|
for (i = 1; i < 32; ++i) {
|
||||||
mjpeg_frame_header(go, buf + size, i);
|
mjpeg_frame_header(go, buf + size, i);
|
||||||
|
@ -651,13 +650,12 @@ static int gen_mpeg1hdr_to_package(struct go7007 *go,
|
||||||
unsigned int addr = 0x19;
|
unsigned int addr = 0x19;
|
||||||
int i, off = 0, chunk;
|
int i, off = 0, chunk;
|
||||||
|
|
||||||
buf = kmalloc(5120, GFP_KERNEL);
|
buf = kzalloc(5120, GFP_KERNEL);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
printk(KERN_ERR "go7007: unable to allocate 5120 bytes for "
|
printk(KERN_ERR "go7007: unable to allocate 5120 bytes for "
|
||||||
"firmware construction\n");
|
"firmware construction\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(buf, 0, 5120);
|
|
||||||
framelen[0] = mpeg1_frame_header(go, buf, 0, 1, PFRAME);
|
framelen[0] = mpeg1_frame_header(go, buf, 0, 1, PFRAME);
|
||||||
if (go->interlace_coding)
|
if (go->interlace_coding)
|
||||||
framelen[0] += mpeg1_frame_header(go, buf + framelen[0] / 8,
|
framelen[0] += mpeg1_frame_header(go, buf + framelen[0] / 8,
|
||||||
|
@ -839,13 +837,12 @@ static int gen_mpeg4hdr_to_package(struct go7007 *go,
|
||||||
unsigned int addr = 0x19;
|
unsigned int addr = 0x19;
|
||||||
int i, off = 0, chunk;
|
int i, off = 0, chunk;
|
||||||
|
|
||||||
buf = kmalloc(5120, GFP_KERNEL);
|
buf = kzalloc(5120, GFP_KERNEL);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
printk(KERN_ERR "go7007: unable to allocate 5120 bytes for "
|
printk(KERN_ERR "go7007: unable to allocate 5120 bytes for "
|
||||||
"firmware construction\n");
|
"firmware construction\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(buf, 0, 5120);
|
|
||||||
framelen[0] = mpeg4_frame_header(go, buf, 0, PFRAME);
|
framelen[0] = mpeg4_frame_header(go, buf, 0, PFRAME);
|
||||||
i = 368;
|
i = 368;
|
||||||
framelen[1] = mpeg4_frame_header(go, buf + i, 0, BFRAME_PRE);
|
framelen[1] = mpeg4_frame_header(go, buf + i, 0, BFRAME_PRE);
|
||||||
|
@ -1585,13 +1582,12 @@ int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen)
|
||||||
go->board_info->firmware);
|
go->board_info->firmware);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
code = kmalloc(codespace * 2, GFP_KERNEL);
|
code = kzalloc(codespace * 2, GFP_KERNEL);
|
||||||
if (code == NULL) {
|
if (code == NULL) {
|
||||||
printk(KERN_ERR "go7007: unable to allocate %d bytes for "
|
printk(KERN_ERR "go7007: unable to allocate %d bytes for "
|
||||||
"firmware construction\n", codespace * 2);
|
"firmware construction\n", codespace * 2);
|
||||||
goto fw_failed;
|
goto fw_failed;
|
||||||
}
|
}
|
||||||
memset(code, 0, codespace * 2);
|
|
||||||
src = (__le16 *)fw_entry->data;
|
src = (__le16 *)fw_entry->data;
|
||||||
srclen = fw_entry->size / 2;
|
srclen = fw_entry->size / 2;
|
||||||
while (srclen >= 2) {
|
while (srclen >= 2) {
|
||||||
|
|
|
@ -670,10 +670,9 @@ static int go7007_usb_onboard_write_interrupt(struct go7007 *go,
|
||||||
"go7007-usb: WriteInterrupt: %04x %04x\n", addr, data);
|
"go7007-usb: WriteInterrupt: %04x %04x\n", addr, data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tbuf = kmalloc(8, GFP_KERNEL);
|
tbuf = kzalloc(8, GFP_KERNEL);
|
||||||
if (tbuf == NULL)
|
if (tbuf == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(tbuf, 0, 8);
|
|
||||||
tbuf[0] = data & 0xff;
|
tbuf[0] = data & 0xff;
|
||||||
tbuf[1] = data >> 8;
|
tbuf[1] = data >> 8;
|
||||||
tbuf[2] = addr & 0xff;
|
tbuf[2] = addr & 0xff;
|
||||||
|
|
|
@ -720,7 +720,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
|
||||||
if (count > 32)
|
if (count > 32)
|
||||||
count = 32;
|
count = 32;
|
||||||
|
|
||||||
gofh->bufs = kmalloc(count * sizeof(struct go7007_buffer),
|
gofh->bufs = kcalloc(count, sizeof(struct go7007_buffer),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|
||||||
if (!gofh->bufs) {
|
if (!gofh->bufs) {
|
||||||
|
@ -728,8 +728,6 @@ static int vidioc_reqbufs(struct file *file, void *priv,
|
||||||
goto unlock_and_return;
|
goto unlock_and_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(gofh->bufs, 0, count * sizeof(struct go7007_buffer));
|
|
||||||
|
|
||||||
for (i = 0; i < count; ++i) {
|
for (i = 0; i < count; ++i) {
|
||||||
gofh->bufs[i].go = go;
|
gofh->bufs[i].go = go;
|
||||||
gofh->bufs[i].index = i;
|
gofh->bufs[i].index = i;
|
||||||
|
|
|
@ -440,10 +440,9 @@ static int saa7134_go7007_init(struct saa7134_dev *dev)
|
||||||
|
|
||||||
printk(KERN_DEBUG "saa7134-go7007: probing new SAA713X board\n");
|
printk(KERN_DEBUG "saa7134-go7007: probing new SAA713X board\n");
|
||||||
|
|
||||||
saa = kmalloc(sizeof(struct saa7134_go7007), GFP_KERNEL);
|
saa = kzalloc(sizeof(struct saa7134_go7007), GFP_KERNEL);
|
||||||
if (saa == NULL)
|
if (saa == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(saa, 0, sizeof(struct saa7134_go7007));
|
|
||||||
|
|
||||||
/* Allocate a couple pages for receiving the compressed stream */
|
/* Allocate a couple pages for receiving the compressed stream */
|
||||||
saa->top = (u8 *)get_zeroed_page(GFP_KERNEL);
|
saa->top = (u8 *)get_zeroed_page(GFP_KERNEL);
|
||||||
|
|
|
@ -95,7 +95,7 @@ static int zfLnxProbe(struct usb_interface *interface,
|
||||||
printk(KERN_NOTICE "USB 1.1 Host\n");
|
printk(KERN_NOTICE "USB 1.1 Host\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
macp = kmalloc(sizeof(struct usbdrv_private), GFP_KERNEL);
|
macp = kzalloc(sizeof(struct usbdrv_private), GFP_KERNEL);
|
||||||
if (!macp)
|
if (!macp)
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "out of memory allocating device structure\n");
|
printk(KERN_ERR "out of memory allocating device structure\n");
|
||||||
|
@ -103,9 +103,6 @@ static int zfLnxProbe(struct usb_interface *interface,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Zero the memory */
|
|
||||||
memset(macp, 0, sizeof(struct usbdrv_private));
|
|
||||||
|
|
||||||
net = alloc_etherdev(0);
|
net = alloc_etherdev(0);
|
||||||
|
|
||||||
if (net == NULL)
|
if (net == NULL)
|
||||||
|
|
|
@ -1906,12 +1906,11 @@ static struct logical_input *panel_bind_key(char *name, char *press,
|
||||||
{
|
{
|
||||||
struct logical_input *key;
|
struct logical_input *key;
|
||||||
|
|
||||||
key = kmalloc(sizeof(struct logical_input), GFP_KERNEL);
|
key = kzalloc(sizeof(struct logical_input), GFP_KERNEL);
|
||||||
if (!key) {
|
if (!key) {
|
||||||
printk(KERN_ERR "panel: not enough memory\n");
|
printk(KERN_ERR "panel: not enough memory\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(key, 0, sizeof(struct logical_input));
|
|
||||||
if (!input_name2mask(name, &key->mask, &key->value, &scan_mask_i,
|
if (!input_name2mask(name, &key->mask, &key->value, &scan_mask_i,
|
||||||
&scan_mask_o))
|
&scan_mask_o))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -238,11 +238,10 @@ static int pohmelfs_send_reply(int err, int msg_num, int action, struct cn_msg *
|
||||||
{
|
{
|
||||||
struct pohmelfs_cn_ack *ack;
|
struct pohmelfs_cn_ack *ack;
|
||||||
|
|
||||||
ack = kmalloc(sizeof(struct pohmelfs_cn_ack), GFP_KERNEL);
|
ack = kzalloc(sizeof(struct pohmelfs_cn_ack), GFP_KERNEL);
|
||||||
if (!ack)
|
if (!ack)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(ack, 0, sizeof(struct pohmelfs_cn_ack));
|
|
||||||
memcpy(&ack->msg, msg, sizeof(struct cn_msg));
|
memcpy(&ack->msg, msg, sizeof(struct cn_msg));
|
||||||
|
|
||||||
if (action == POHMELFS_CTLINFO_ACK)
|
if (action == POHMELFS_CTLINFO_ACK)
|
||||||
|
|
|
@ -109,11 +109,10 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
|
||||||
if (hcrypt == NULL)
|
if (hcrypt == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
alg = kmalloc(sizeof(*alg), GFP_KERNEL);
|
alg = kzalloc(sizeof(*alg), GFP_KERNEL);
|
||||||
if (alg == NULL)
|
if (alg == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(alg, 0, sizeof(*alg));
|
|
||||||
alg->ops = ops;
|
alg->ops = ops;
|
||||||
|
|
||||||
spin_lock_irqsave(&hcrypt->lock, flags);
|
spin_lock_irqsave(&hcrypt->lock, flags);
|
||||||
|
@ -207,11 +206,10 @@ int ieee80211_crypto_init(void)
|
||||||
{
|
{
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL);
|
hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL);
|
||||||
if (!hcrypt)
|
if (!hcrypt)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
memset(hcrypt, 0, sizeof(*hcrypt));
|
|
||||||
INIT_LIST_HEAD(&hcrypt->algs);
|
INIT_LIST_HEAD(&hcrypt->algs);
|
||||||
spin_lock_init(&hcrypt->lock);
|
spin_lock_init(&hcrypt->lock);
|
||||||
|
|
||||||
|
|
|
@ -69,10 +69,9 @@ static void * ieee80211_ccmp_init(int key_idx)
|
||||||
{
|
{
|
||||||
struct ieee80211_ccmp_data *priv;
|
struct ieee80211_ccmp_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = key_idx;
|
priv->key_idx = key_idx;
|
||||||
|
|
||||||
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
|
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
|
||||||
|
|
|
@ -70,10 +70,9 @@ static void * ieee80211_tkip_init(int key_idx)
|
||||||
{
|
{
|
||||||
struct ieee80211_tkip_data *priv;
|
struct ieee80211_tkip_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = key_idx;
|
priv->key_idx = key_idx;
|
||||||
|
|
||||||
priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
|
priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
|
||||||
|
|
|
@ -45,10 +45,9 @@ static void * prism2_wep_init(int keyidx)
|
||||||
{
|
{
|
||||||
struct prism2_wep_data *priv;
|
struct prism2_wep_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = keyidx;
|
priv->key_idx = keyidx;
|
||||||
priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
|
priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
|
||||||
if (IS_ERR(priv->tx_tfm)) {
|
if (IS_ERR(priv->tx_tfm)) {
|
||||||
|
|
|
@ -66,8 +66,8 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
|
||||||
if (ieee->networks)
|
if (ieee->networks)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ieee->networks = kmalloc(
|
ieee->networks = kcalloc(
|
||||||
MAX_NETWORK_COUNT * sizeof(struct ieee80211_network),
|
MAX_NETWORK_COUNT, sizeof(struct ieee80211_network),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!ieee->networks) {
|
if (!ieee->networks) {
|
||||||
printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
|
printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
|
||||||
|
@ -75,9 +75,6 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(ieee->networks, 0,
|
|
||||||
MAX_NETWORK_COUNT * sizeof(struct ieee80211_network));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -325,11 +325,10 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
|
||||||
struct ieee80211_crypt_data *new_crypt;
|
struct ieee80211_crypt_data *new_crypt;
|
||||||
|
|
||||||
/* take WEP into use */
|
/* take WEP into use */
|
||||||
new_crypt = kmalloc(sizeof(struct ieee80211_crypt_data),
|
new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (new_crypt == NULL)
|
if (new_crypt == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
|
|
||||||
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
||||||
if (!new_crypt->ops)
|
if (!new_crypt->ops)
|
||||||
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
||||||
|
|
|
@ -109,11 +109,10 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
|
||||||
if (hcrypt == NULL)
|
if (hcrypt == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
alg = kmalloc(sizeof(*alg), GFP_KERNEL);
|
alg = kzalloc(sizeof(*alg), GFP_KERNEL);
|
||||||
if (alg == NULL)
|
if (alg == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(alg, 0, sizeof(*alg));
|
|
||||||
alg->ops = ops;
|
alg->ops = ops;
|
||||||
|
|
||||||
spin_lock_irqsave(&hcrypt->lock, flags);
|
spin_lock_irqsave(&hcrypt->lock, flags);
|
||||||
|
@ -207,11 +206,10 @@ int __init ieee80211_crypto_init(void)
|
||||||
{
|
{
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL);
|
hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL);
|
||||||
if (!hcrypt)
|
if (!hcrypt)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
memset(hcrypt, 0, sizeof(*hcrypt));
|
|
||||||
INIT_LIST_HEAD(&hcrypt->algs);
|
INIT_LIST_HEAD(&hcrypt->algs);
|
||||||
spin_lock_init(&hcrypt->lock);
|
spin_lock_init(&hcrypt->lock);
|
||||||
|
|
||||||
|
|
|
@ -96,10 +96,9 @@ static void * ieee80211_ccmp_init(int key_idx)
|
||||||
{
|
{
|
||||||
struct ieee80211_ccmp_data *priv;
|
struct ieee80211_ccmp_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = key_idx;
|
priv->key_idx = key_idx;
|
||||||
|
|
||||||
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
||||||
|
|
|
@ -87,10 +87,9 @@ static void * ieee80211_tkip_init(int key_idx)
|
||||||
{
|
{
|
||||||
struct ieee80211_tkip_data *priv;
|
struct ieee80211_tkip_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = key_idx;
|
priv->key_idx = key_idx;
|
||||||
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
||||||
priv->tx_tfm_arc4 = crypto_alloc_tfm("arc4", 0);
|
priv->tx_tfm_arc4 = crypto_alloc_tfm("arc4", 0);
|
||||||
|
|
|
@ -71,10 +71,9 @@ static void * prism2_wep_init(int keyidx)
|
||||||
{
|
{
|
||||||
struct prism2_wep_data *priv;
|
struct prism2_wep_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = keyidx;
|
priv->key_idx = keyidx;
|
||||||
|
|
||||||
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
|
||||||
|
|
|
@ -65,8 +65,8 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
|
||||||
if (ieee->networks)
|
if (ieee->networks)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ieee->networks = kmalloc(
|
ieee->networks = kcalloc(
|
||||||
MAX_NETWORK_COUNT * sizeof(struct ieee80211_network),
|
MAX_NETWORK_COUNT, sizeof(struct ieee80211_network),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!ieee->networks) {
|
if (!ieee->networks) {
|
||||||
printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
|
printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
|
||||||
|
@ -74,9 +74,6 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(ieee->networks, 0,
|
|
||||||
MAX_NETWORK_COUNT * sizeof(struct ieee80211_network));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3079,10 +3079,9 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
|
||||||
ieee->seq_ctrl[i] = 0;
|
ieee->seq_ctrl[i] = 0;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_DOT11D
|
#ifdef ENABLE_DOT11D
|
||||||
ieee->pDot11dInfo = kmalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
|
ieee->pDot11dInfo = kzalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
|
||||||
if (!ieee->pDot11dInfo)
|
if (!ieee->pDot11dInfo)
|
||||||
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for DOT11D\n");
|
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for DOT11D\n");
|
||||||
memset(ieee->pDot11dInfo, 0, sizeof(RT_DOT11D_INFO));
|
|
||||||
#endif
|
#endif
|
||||||
//added for AP roaming
|
//added for AP roaming
|
||||||
ieee->LinkDetectInfo.SlotNum = 2;
|
ieee->LinkDetectInfo.SlotNum = 2;
|
||||||
|
|
|
@ -477,11 +477,10 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
|
||||||
struct ieee80211_crypt_data *new_crypt;
|
struct ieee80211_crypt_data *new_crypt;
|
||||||
|
|
||||||
/* take WEP into use */
|
/* take WEP into use */
|
||||||
new_crypt = kmalloc(sizeof(struct ieee80211_crypt_data),
|
new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (new_crypt == NULL)
|
if (new_crypt == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
|
|
||||||
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
||||||
if (!new_crypt->ops)
|
if (!new_crypt->ops)
|
||||||
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
||||||
|
|
|
@ -109,11 +109,10 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
|
||||||
if (hcrypt == NULL)
|
if (hcrypt == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
alg = kmalloc(sizeof(*alg), GFP_KERNEL);
|
alg = kzalloc(sizeof(*alg), GFP_KERNEL);
|
||||||
if (alg == NULL)
|
if (alg == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(alg, 0, sizeof(*alg));
|
|
||||||
alg->ops = ops;
|
alg->ops = ops;
|
||||||
|
|
||||||
spin_lock_irqsave(&hcrypt->lock, flags);
|
spin_lock_irqsave(&hcrypt->lock, flags);
|
||||||
|
@ -206,11 +205,10 @@ int __init ieee80211_crypto_init(void)
|
||||||
{
|
{
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL);
|
hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL);
|
||||||
if (!hcrypt)
|
if (!hcrypt)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
memset(hcrypt, 0, sizeof(*hcrypt));
|
|
||||||
INIT_LIST_HEAD(&hcrypt->algs);
|
INIT_LIST_HEAD(&hcrypt->algs);
|
||||||
spin_lock_init(&hcrypt->lock);
|
spin_lock_init(&hcrypt->lock);
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,9 @@ static void * ieee80211_ccmp_init(int key_idx)
|
||||||
{
|
{
|
||||||
struct ieee80211_ccmp_data *priv;
|
struct ieee80211_ccmp_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = key_idx;
|
priv->key_idx = key_idx;
|
||||||
|
|
||||||
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
|
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
|
||||||
|
|
|
@ -67,10 +67,9 @@ static void * ieee80211_tkip_init(int key_idx)
|
||||||
{
|
{
|
||||||
struct ieee80211_tkip_data *priv;
|
struct ieee80211_tkip_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = key_idx;
|
priv->key_idx = key_idx;
|
||||||
|
|
||||||
priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
|
priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
|
||||||
|
|
|
@ -43,10 +43,9 @@ static void * prism2_wep_init(int keyidx)
|
||||||
{
|
{
|
||||||
struct prism2_wep_data *priv;
|
struct prism2_wep_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = keyidx;
|
priv->key_idx = keyidx;
|
||||||
|
|
||||||
priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
|
priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
|
||||||
|
|
|
@ -65,8 +65,8 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
|
||||||
if (ieee->networks)
|
if (ieee->networks)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ieee->networks = kmalloc(
|
ieee->networks = kcalloc(
|
||||||
MAX_NETWORK_COUNT * sizeof(struct ieee80211_network),
|
MAX_NETWORK_COUNT, sizeof(struct ieee80211_network),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!ieee->networks) {
|
if (!ieee->networks) {
|
||||||
printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
|
printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
|
||||||
|
@ -74,9 +74,6 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(ieee->networks, 0,
|
|
||||||
MAX_NETWORK_COUNT * sizeof(struct ieee80211_network));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2699,10 +2699,9 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
|
||||||
for(i = 0; i < 5; i++) {
|
for(i = 0; i < 5; i++) {
|
||||||
ieee->seq_ctrl[i] = 0;
|
ieee->seq_ctrl[i] = 0;
|
||||||
}
|
}
|
||||||
ieee->pDot11dInfo = kmalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
|
ieee->pDot11dInfo = kzalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
|
||||||
if (!ieee->pDot11dInfo)
|
if (!ieee->pDot11dInfo)
|
||||||
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for DOT11D\n");
|
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for DOT11D\n");
|
||||||
memset(ieee->pDot11dInfo, 0, sizeof(RT_DOT11D_INFO));
|
|
||||||
//added for AP roaming
|
//added for AP roaming
|
||||||
ieee->LinkDetectInfo.SlotNum = 2;
|
ieee->LinkDetectInfo.SlotNum = 2;
|
||||||
ieee->LinkDetectInfo.NumRecvBcnInPeriod=0;
|
ieee->LinkDetectInfo.NumRecvBcnInPeriod=0;
|
||||||
|
|
|
@ -352,11 +352,10 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
|
||||||
struct ieee80211_crypt_data *new_crypt;
|
struct ieee80211_crypt_data *new_crypt;
|
||||||
|
|
||||||
/* take WEP into use */
|
/* take WEP into use */
|
||||||
new_crypt = kmalloc(sizeof(struct ieee80211_crypt_data),
|
new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (new_crypt == NULL)
|
if (new_crypt == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
|
|
||||||
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
||||||
if (!new_crypt->ops)
|
if (!new_crypt->ops)
|
||||||
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
||||||
|
|
|
@ -131,12 +131,10 @@ struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
|
||||||
if (alg == NULL)
|
if (alg == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
tfm = kmalloc(sizeof(*tfm) + alg->cra_ctxsize, GFP_KERNEL);
|
tfm = kzalloc(sizeof(*tfm) + alg->cra_ctxsize, GFP_KERNEL);
|
||||||
if (tfm == NULL)
|
if (tfm == NULL)
|
||||||
goto out_put;
|
goto out_put;
|
||||||
|
|
||||||
memset(tfm, 0, sizeof(*tfm) + alg->cra_ctxsize);
|
|
||||||
|
|
||||||
tfm->__crt_alg = alg;
|
tfm->__crt_alg = alg;
|
||||||
|
|
||||||
if (crypto_init_flags(tfm, flags))
|
if (crypto_init_flags(tfm, flags))
|
||||||
|
|
|
@ -109,11 +109,10 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
|
||||||
if (hcrypt == NULL)
|
if (hcrypt == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
alg = kmalloc(sizeof(*alg), GFP_KERNEL);
|
alg = kzalloc(sizeof(*alg), GFP_KERNEL);
|
||||||
if (alg == NULL)
|
if (alg == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(alg, 0, sizeof(*alg));
|
|
||||||
alg->ops = ops;
|
alg->ops = ops;
|
||||||
|
|
||||||
spin_lock_irqsave(&hcrypt->lock, flags);
|
spin_lock_irqsave(&hcrypt->lock, flags);
|
||||||
|
@ -206,11 +205,10 @@ int __init ieee80211_crypto_init(void)
|
||||||
{
|
{
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL);
|
hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL);
|
||||||
if (!hcrypt)
|
if (!hcrypt)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
memset(hcrypt, 0, sizeof(*hcrypt));
|
|
||||||
INIT_LIST_HEAD(&hcrypt->algs);
|
INIT_LIST_HEAD(&hcrypt->algs);
|
||||||
spin_lock_init(&hcrypt->lock);
|
spin_lock_init(&hcrypt->lock);
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,9 @@ static void * ieee80211_ccmp_init(int key_idx)
|
||||||
{
|
{
|
||||||
struct ieee80211_ccmp_data *priv;
|
struct ieee80211_ccmp_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = key_idx;
|
priv->key_idx = key_idx;
|
||||||
|
|
||||||
priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
|
priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
|
||||||
|
|
|
@ -67,10 +67,9 @@ static void * ieee80211_tkip_init(int key_idx)
|
||||||
{
|
{
|
||||||
struct ieee80211_tkip_data *priv;
|
struct ieee80211_tkip_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = key_idx;
|
priv->key_idx = key_idx;
|
||||||
|
|
||||||
priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
|
priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
|
||||||
|
|
|
@ -43,10 +43,9 @@ static void * prism2_wep_init(int keyidx)
|
||||||
{
|
{
|
||||||
struct prism2_wep_data *priv;
|
struct prism2_wep_data *priv;
|
||||||
|
|
||||||
priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
|
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
memset(priv, 0, sizeof(*priv));
|
|
||||||
priv->key_idx = keyidx;
|
priv->key_idx = keyidx;
|
||||||
|
|
||||||
priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
|
priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
|
||||||
|
|
|
@ -65,8 +65,8 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
|
||||||
if (ieee->networks)
|
if (ieee->networks)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ieee->networks = kmalloc(
|
ieee->networks = kcalloc(
|
||||||
MAX_NETWORK_COUNT * sizeof(struct ieee80211_network),
|
MAX_NETWORK_COUNT, sizeof(struct ieee80211_network),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!ieee->networks) {
|
if (!ieee->networks) {
|
||||||
printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
|
printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
|
||||||
|
@ -74,9 +74,6 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(ieee->networks, 0,
|
|
||||||
MAX_NETWORK_COUNT * sizeof(struct ieee80211_network));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2723,10 +2723,9 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
|
||||||
ieee->seq_ctrl[i] = 0;
|
ieee->seq_ctrl[i] = 0;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_DOT11D
|
#ifdef ENABLE_DOT11D
|
||||||
ieee->pDot11dInfo = kmalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
|
ieee->pDot11dInfo = kzalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
|
||||||
if (!ieee->pDot11dInfo)
|
if (!ieee->pDot11dInfo)
|
||||||
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for DOT11D\n");
|
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for DOT11D\n");
|
||||||
memset(ieee->pDot11dInfo, 0, sizeof(RT_DOT11D_INFO));
|
|
||||||
#endif
|
#endif
|
||||||
//added for AP roaming
|
//added for AP roaming
|
||||||
ieee->LinkDetectInfo.SlotNum = 2;
|
ieee->LinkDetectInfo.SlotNum = 2;
|
||||||
|
|
|
@ -379,11 +379,10 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
|
||||||
struct ieee80211_crypt_data *new_crypt;
|
struct ieee80211_crypt_data *new_crypt;
|
||||||
|
|
||||||
/* take WEP into use */
|
/* take WEP into use */
|
||||||
new_crypt = kmalloc(sizeof(struct ieee80211_crypt_data),
|
new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (new_crypt == NULL)
|
if (new_crypt == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
|
|
||||||
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
|
||||||
if (!new_crypt->ops) {
|
if (!new_crypt->ops) {
|
||||||
request_module("ieee80211_crypt_wep");
|
request_module("ieee80211_crypt_wep");
|
||||||
|
|
|
@ -2251,13 +2251,11 @@ short rtl8192_usb_initendpoints(struct net_device *dev)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB);
|
memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB);
|
||||||
priv->pp_rxskb = kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB,
|
priv->pp_rxskb = kcalloc(MAX_RX_URB, sizeof(struct sk_buff *),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (priv->pp_rxskb == NULL)
|
if (priv->pp_rxskb == NULL)
|
||||||
goto destroy;
|
goto destroy;
|
||||||
|
|
||||||
memset(priv->pp_rxskb, 0, sizeof(struct sk_buff*) * MAX_RX_URB);
|
|
||||||
|
|
||||||
goto _middle;
|
goto _middle;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -688,13 +688,11 @@ static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *dev,
|
||||||
{
|
{
|
||||||
struct smtcfb_info *sfb;
|
struct smtcfb_info *sfb;
|
||||||
|
|
||||||
sfb = kmalloc(sizeof(struct smtcfb_info), GFP_KERNEL);
|
sfb = kzalloc(sizeof(struct smtcfb_info), GFP_KERNEL);
|
||||||
|
|
||||||
if (!sfb)
|
if (!sfb)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(sfb, 0, sizeof(struct smtcfb_info));
|
|
||||||
|
|
||||||
sfb->currcon = -1;
|
sfb->currcon = -1;
|
||||||
sfb->dev = dev;
|
sfb->dev = dev;
|
||||||
|
|
||||||
|
|
|
@ -1494,7 +1494,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
/* We want to support more than one of each bridge so we need to
|
/* We want to support more than one of each bridge so we need to
|
||||||
* dynamically allocate the bridge structure
|
* dynamically allocate the bridge structure
|
||||||
*/
|
*/
|
||||||
ca91cx42_bridge = kmalloc(sizeof(struct vme_bridge), GFP_KERNEL);
|
ca91cx42_bridge = kzalloc(sizeof(struct vme_bridge), GFP_KERNEL);
|
||||||
|
|
||||||
if (ca91cx42_bridge == NULL) {
|
if (ca91cx42_bridge == NULL) {
|
||||||
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
||||||
|
@ -1503,9 +1503,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
goto err_struct;
|
goto err_struct;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(ca91cx42_bridge, 0, sizeof(struct vme_bridge));
|
ca91cx42_device = kzalloc(sizeof(struct ca91cx42_driver), GFP_KERNEL);
|
||||||
|
|
||||||
ca91cx42_device = kmalloc(sizeof(struct ca91cx42_driver), GFP_KERNEL);
|
|
||||||
|
|
||||||
if (ca91cx42_device == NULL) {
|
if (ca91cx42_device == NULL) {
|
||||||
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
||||||
|
@ -1514,8 +1512,6 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
goto err_driver;
|
goto err_driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(ca91cx42_device, 0, sizeof(struct ca91cx42_driver));
|
|
||||||
|
|
||||||
ca91cx42_bridge->driver_priv = ca91cx42_device;
|
ca91cx42_bridge->driver_priv = ca91cx42_device;
|
||||||
|
|
||||||
/* Enable the device */
|
/* Enable the device */
|
||||||
|
|
|
@ -2230,7 +2230,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
/* If we want to support more than one of each bridge, we need to
|
/* If we want to support more than one of each bridge, we need to
|
||||||
* dynamically generate this so we get one per device
|
* dynamically generate this so we get one per device
|
||||||
*/
|
*/
|
||||||
tsi148_bridge = kmalloc(sizeof(struct vme_bridge), GFP_KERNEL);
|
tsi148_bridge = kzalloc(sizeof(struct vme_bridge), GFP_KERNEL);
|
||||||
if (tsi148_bridge == NULL) {
|
if (tsi148_bridge == NULL) {
|
||||||
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
||||||
"structure\n");
|
"structure\n");
|
||||||
|
@ -2238,9 +2238,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
goto err_struct;
|
goto err_struct;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(tsi148_bridge, 0, sizeof(struct vme_bridge));
|
tsi148_device = kzalloc(sizeof(struct tsi148_driver), GFP_KERNEL);
|
||||||
|
|
||||||
tsi148_device = kmalloc(sizeof(struct tsi148_driver), GFP_KERNEL);
|
|
||||||
if (tsi148_device == NULL) {
|
if (tsi148_device == NULL) {
|
||||||
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
||||||
"structure\n");
|
"structure\n");
|
||||||
|
@ -2248,8 +2246,6 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
goto err_driver;
|
goto err_driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(tsi148_device, 0, sizeof(struct tsi148_driver));
|
|
||||||
|
|
||||||
tsi148_bridge->driver_priv = tsi148_device;
|
tsi148_bridge->driver_priv = tsi148_device;
|
||||||
|
|
||||||
/* Enable the device */
|
/* Enable the device */
|
||||||
|
|
|
@ -90,10 +90,9 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
|
||||||
|
|
||||||
pDevice->apdev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
|
pDevice->apdev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
|
||||||
if (pDevice->apdev == NULL)
|
if (pDevice->apdev == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(pDevice->apdev, 0, sizeof(struct net_device));
|
|
||||||
|
|
||||||
apdev_priv = netdev_priv(pDevice->apdev);
|
apdev_priv = netdev_priv(pDevice->apdev);
|
||||||
*apdev_priv = *pDevice;
|
*apdev_priv = *pDevice;
|
||||||
|
|
|
@ -681,13 +681,12 @@ static int wpa_get_scan(PSDevice pDevice,
|
||||||
count++;
|
count++;
|
||||||
};
|
};
|
||||||
|
|
||||||
pBuf = kmalloc(sizeof(struct viawget_scan_result) * count, (int)GFP_ATOMIC);
|
pBuf = kcalloc(count, sizeof(struct viawget_scan_result), (int)GFP_ATOMIC);
|
||||||
|
|
||||||
if (pBuf == NULL) {
|
if (pBuf == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
memset(pBuf, 0, sizeof(struct viawget_scan_result) * count);
|
|
||||||
scan_buf = (struct viawget_scan_result *)pBuf;
|
scan_buf = (struct viawget_scan_result *)pBuf;
|
||||||
pBSS = &(pMgmt->sBSSList[0]);
|
pBSS = &(pMgmt->sBSSList[0]);
|
||||||
for (ii = 0, jj = 0; ii < MAX_BSS_NUM ; ii++) {
|
for (ii = 0, jj = 0; ii < MAX_BSS_NUM ; ii++) {
|
||||||
|
|
|
@ -91,10 +91,9 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
|
||||||
|
|
||||||
pDevice->apdev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
|
pDevice->apdev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
|
||||||
if (pDevice->apdev == NULL)
|
if (pDevice->apdev == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(pDevice->apdev, 0, sizeof(struct net_device));
|
|
||||||
|
|
||||||
apdev_priv = netdev_priv(pDevice->apdev);
|
apdev_priv = netdev_priv(pDevice->apdev);
|
||||||
*apdev_priv = *pDevice;
|
*apdev_priv = *pDevice;
|
||||||
|
|
|
@ -678,13 +678,12 @@ static int wpa_get_scan(PSDevice pDevice,
|
||||||
count++;
|
count++;
|
||||||
};
|
};
|
||||||
|
|
||||||
pBuf = kmalloc(sizeof(struct viawget_scan_result) * count, (int)GFP_ATOMIC);
|
pBuf = kcalloc(count, sizeof(struct viawget_scan_result), (int)GFP_ATOMIC);
|
||||||
|
|
||||||
if (pBuf == NULL) {
|
if (pBuf == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
memset(pBuf, 0, sizeof(struct viawget_scan_result) * count);
|
|
||||||
scan_buf = (struct viawget_scan_result *)pBuf;
|
scan_buf = (struct viawget_scan_result *)pBuf;
|
||||||
pBSS = &(pMgmt->sBSSList[0]);
|
pBSS = &(pMgmt->sBSSList[0]);
|
||||||
for (ii = 0, jj = 0; ii < MAX_BSS_NUM ; ii++) {
|
for (ii = 0, jj = 0; ii < MAX_BSS_NUM ; ii++) {
|
||||||
|
|
|
@ -601,7 +601,7 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate the rxmeta */
|
/* Allocate the rxmeta */
|
||||||
rxmeta = kmalloc(sizeof(p80211_rxmeta_t), GFP_ATOMIC);
|
rxmeta = kzalloc(sizeof(p80211_rxmeta_t), GFP_ATOMIC);
|
||||||
|
|
||||||
if (rxmeta == NULL) {
|
if (rxmeta == NULL) {
|
||||||
printk(KERN_ERR "%s: Failed to allocate rxmeta.\n",
|
printk(KERN_ERR "%s: Failed to allocate rxmeta.\n",
|
||||||
|
@ -611,7 +611,6 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the rxmeta */
|
/* Initialize the rxmeta */
|
||||||
memset(rxmeta, 0, sizeof(p80211_rxmeta_t));
|
|
||||||
rxmeta->wlandev = wlandev;
|
rxmeta->wlandev = wlandev;
|
||||||
rxmeta->hosttime = jiffies;
|
rxmeta->hosttime = jiffies;
|
||||||
|
|
||||||
|
|
|
@ -536,13 +536,12 @@ int mkimage(imgchunk_t *clist, unsigned int *ccnt)
|
||||||
|
|
||||||
/* Allocate buffer space for chunks */
|
/* Allocate buffer space for chunks */
|
||||||
for (i = 0; i < *ccnt; i++) {
|
for (i = 0; i < *ccnt; i++) {
|
||||||
clist[i].data = kmalloc(clist[i].len, GFP_KERNEL);
|
clist[i].data = kzalloc(clist[i].len, GFP_KERNEL);
|
||||||
if (clist[i].data == NULL) {
|
if (clist[i].data == NULL) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"failed to allocate image space, exitting.\n");
|
"failed to allocate image space, exitting.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
memset(clist[i].data, 0, clist[i].len);
|
|
||||||
pr_debug("chunk[%d]: addr=0x%06x len=%d\n",
|
pr_debug("chunk[%d]: addr=0x%06x len=%d\n",
|
||||||
i, clist[i].addr, clist[i].len);
|
i, clist[i].addr, clist[i].len);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue