Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 141748
b: refs/heads/master
c: 6d0d63b
h: refs/heads/master
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Apr 3, 2009
1 parent 88784eb commit 25a39ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0f386e2b4c6109164e82277513a9570fc9ec644c
refs/heads/master: 6d0d63bd7a9c0a6373c7759cb55580b806269dae
21 changes: 11 additions & 10 deletions trunk/drivers/staging/p9auth/p9auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static char *cap_hash(char *plain_text, unsigned int plain_text_size,
char *key, unsigned int key_size)
{
struct scatterlist sg;
char *result = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL);
char *result;
struct crypto_hash *tfm;
struct hash_desc desc;
int ret;
Expand All @@ -96,14 +96,18 @@ static char *cap_hash(char *plain_text, unsigned int plain_text_size,
printk(KERN_ERR
"failed to load transform for hmac(sha1): %ld\n",
PTR_ERR(tfm));
kfree(result);
return NULL;
}

desc.tfm = tfm;
desc.flags = 0;

memset(result, 0, MAX_DIGEST_SIZE);
result = kzalloc(MAX_DIGEST_SIZE, GFP_KERNEL);
if (!result) {
printk(KERN_ERR "out of memory!\n");
goto out;
}

sg_set_buf(&sg, plain_text, plain_text_size);

ret = crypto_hash_setkey(tfm, key, key_size);
Expand Down Expand Up @@ -187,8 +191,7 @@ static ssize_t cap_write(struct file *filp, const char __user *buf,
return -ERESTARTSYS;

node_ptr = kmalloc(sizeof(struct cap_node), GFP_KERNEL);
user_buf = kmalloc(count, GFP_KERNEL);
memset(user_buf, 0, count);
user_buf = kzalloc(count, GFP_KERNEL);

if (copy_from_user(user_buf, buf, count)) {
retval = -EFAULT;
Expand Down Expand Up @@ -218,8 +221,7 @@ static ssize_t cap_write(struct file *filp, const char __user *buf,

/* hash the string user1@user2 with rand_str as the key */
len = strlen(source_user) + strlen(target_user) + 1;
hash_str = kmalloc(len, GFP_KERNEL);
memset(hash_str, 0, len);
hash_str = kzalloc(len, GFP_KERNEL);
strcat(hash_str, source_user);
strcat(hash_str, "@");
strcat(hash_str, target_user);
Expand Down Expand Up @@ -364,13 +366,12 @@ static int cap_init_module(void)
return result;
}

cap_devices =
kmalloc(cap_nr_devs * sizeof(struct cap_dev), GFP_KERNEL);
cap_devices = kzalloc(cap_nr_devs * sizeof(struct cap_dev),
GFP_KERNEL);
if (!cap_devices) {
result = -ENOMEM;
goto fail;
}
memset(cap_devices, 0, cap_nr_devs * sizeof(struct cap_dev));

/* Initialize each device. */
for (i = 0; i < cap_nr_devs; i++) {
Expand Down

0 comments on commit 25a39ea

Please sign in to comment.