Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106113
b: refs/heads/master
c: 16c14b4
h: refs/heads/master
i:
  106111: 36bd3db
v: v3
  • Loading branch information
Nathan Fontenot authored and Benjamin Herrenschmidt committed Jul 25, 2008
1 parent 46abcd1 commit 3f1beea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 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: 8391e42a5c1f3d757faa5e7f46a4a68f9aa6cb12
refs/heads/master: 16c14b4621c7b6fc4611abf1f86cd78cdb1b2b03
28 changes: 12 additions & 16 deletions trunk/arch/powerpc/kernel/lparcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,62 +573,60 @@ static ssize_t update_mpp(u64 *entitlement, u8 *weight)
static ssize_t lparcfg_write(struct file *file, const char __user * buf,
size_t count, loff_t * off)
{
char *kbuf;
int kbuf_sz = 64;
char kbuf[kbuf_sz];
char *tmp;
u64 new_entitled, *new_entitled_ptr = &new_entitled;
u8 new_weight, *new_weight_ptr = &new_weight;
ssize_t retval = -ENOMEM;
ssize_t retval;

if (!firmware_has_feature(FW_FEATURE_SPLPAR) ||
firmware_has_feature(FW_FEATURE_ISERIES))
return -EINVAL;

kbuf = kmalloc(count, GFP_KERNEL);
if (!kbuf)
goto out;
if (count > kbuf_sz)
return -EINVAL;

retval = -EFAULT;
if (copy_from_user(kbuf, buf, count))
goto out;
return -EFAULT;

retval = -EINVAL;
kbuf[count - 1] = '\0';
tmp = strchr(kbuf, '=');
if (!tmp)
goto out;
return -EINVAL;

*tmp++ = '\0';

if (!strcmp(kbuf, "partition_entitled_capacity")) {
char *endp;
*new_entitled_ptr = (u64) simple_strtoul(tmp, &endp, 10);
if (endp == tmp)
goto out;
return -EINVAL;

retval = update_ppp(new_entitled_ptr, NULL);
} else if (!strcmp(kbuf, "capacity_weight")) {
char *endp;
*new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10);
if (endp == tmp)
goto out;
return -EINVAL;

retval = update_ppp(NULL, new_weight_ptr);
} else if (!strcmp(kbuf, "entitled_memory")) {
char *endp;
*new_entitled_ptr = (u64) simple_strtoul(tmp, &endp, 10);
if (endp == tmp)
goto out;
return -EINVAL;

retval = update_mpp(new_entitled_ptr, NULL);
} else if (!strcmp(kbuf, "entitled_memory_weight")) {
char *endp;
*new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10);
if (endp == tmp)
goto out;
return -EINVAL;

retval = update_mpp(NULL, new_weight_ptr);
} else
goto out;
return -EINVAL;

if (retval == H_SUCCESS || retval == H_CONSTRAINED) {
retval = count;
Expand All @@ -644,8 +642,6 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
retval = -EIO;
}

out:
kfree(kbuf);
return retval;
}

Expand Down

0 comments on commit 3f1beea

Please sign in to comment.