Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84893
b: refs/heads/master
c: cb79f19
h: refs/heads/master
i:
  84891: fa0151e
v: v3
  • Loading branch information
Al Viro authored and David Teigland committed Feb 4, 2008
1 parent 711aee9 commit 6d9407f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 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: 043b19cdc081f586a8f4e1c93ce6c03b63c26284
refs/heads/master: cb79f1998d89821a4dbac47f59a46ee3fbbf3c61
19 changes: 8 additions & 11 deletions trunk/fs/dlm/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct dlm_lock_result32 {

static void compat_input(struct dlm_write_request *kb,
struct dlm_write_request32 *kb32,
int max_namelen)
size_t count)
{
kb->version[0] = kb32->version[0];
kb->version[1] = kb32->version[1];
Expand All @@ -94,7 +94,8 @@ static void compat_input(struct dlm_write_request *kb,
kb->cmd == DLM_USER_REMOVE_LOCKSPACE) {
kb->i.lspace.flags = kb32->i.lspace.flags;
kb->i.lspace.minor = kb32->i.lspace.minor;
strcpy(kb->i.lspace.name, kb32->i.lspace.name);
memcpy(kb->i.lspace.name, kb32->i.lspace.name, count -
offsetof(struct dlm_write_request32, i.lspace.name));
} else if (kb->cmd == DLM_USER_PURGE) {
kb->i.purge.nodeid = kb32->i.purge.nodeid;
kb->i.purge.pid = kb32->i.purge.pid;
Expand All @@ -112,11 +113,8 @@ static void compat_input(struct dlm_write_request *kb,
kb->i.lock.bastaddr = (void *)(long)kb32->i.lock.bastaddr;
kb->i.lock.lksb = (void *)(long)kb32->i.lock.lksb;
memcpy(kb->i.lock.lvb, kb32->i.lock.lvb, DLM_USER_LVB_LEN);
if (kb->i.lock.namelen <= max_namelen)
memcpy(kb->i.lock.name, kb32->i.lock.name,
kb->i.lock.namelen);
else
kb->i.lock.namelen = max_namelen;
memcpy(kb->i.lock.name, kb32->i.lock.name, count -
offsetof(struct dlm_write_request32, i.lock.name));
}
}

Expand Down Expand Up @@ -508,7 +506,7 @@ static ssize_t device_write(struct file *file, const char __user *buf,
#endif
return -EINVAL;

kbuf = kmalloc(count, GFP_KERNEL);
kbuf = kzalloc(count + 1, GFP_KERNEL);
if (!kbuf)
return -ENOMEM;

Expand All @@ -526,15 +524,14 @@ static ssize_t device_write(struct file *file, const char __user *buf,
if (!kbuf->is64bit) {
struct dlm_write_request32 *k32buf;
k32buf = (struct dlm_write_request32 *)kbuf;
kbuf = kmalloc(count + (sizeof(struct dlm_write_request) -
kbuf = kmalloc(count + 1 + (sizeof(struct dlm_write_request) -
sizeof(struct dlm_write_request32)), GFP_KERNEL);
if (!kbuf)
return -ENOMEM;

if (proc)
set_bit(DLM_PROC_FLAGS_COMPAT, &proc->flags);
compat_input(kbuf, k32buf,
count - sizeof(struct dlm_write_request32));
compat_input(kbuf, k32buf, count + 1);
kfree(k32buf);
}
#endif
Expand Down

0 comments on commit 6d9407f

Please sign in to comment.