summaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2009-10-29 15:04:07 +0100
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2009-10-29 15:05:12 +0100
commit3f0b3c33eeed400577b47fab8439ffe6f40aa97a (patch)
tree42900d693cb11c0df028daed1e17ac499eff1ed7 /drivers/s390
parent964fe080d94db82a3268443e9b9ece4c60246414 (diff)
downloadop-kernel-dev-3f0b3c33eeed400577b47fab8439ffe6f40aa97a.zip
op-kernel-dev-3f0b3c33eeed400577b47fab8439ffe6f40aa97a.tar.gz
[S390] call home: fix local buffer usage in proc handler
Fix the size of the local buffer and use snprintf to prevent further miscalculations. Also fix the usage of bitwise vs logic operations. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/sclp_async.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
index a4f68e5..bf4a9f4 100644
--- a/drivers/s390/char/sclp_async.c
+++ b/drivers/s390/char/sclp_async.c
@@ -68,15 +68,14 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write,
{
unsigned long val;
int len, rc;
- char buf[2];
+ char buf[3];
- if (!*count | (*ppos && !write)) {
+ if (!*count || (*ppos && !write)) {
*count = 0;
return 0;
}
if (!write) {
- len = sprintf(buf, "%d\n", callhome_enabled);
- buf[len] = '\0';
+ len = snprintf(buf, sizeof(buf), "%d\n", callhome_enabled);
rc = copy_to_user(buffer, buf, sizeof(buf));
if (rc != 0)
return -EFAULT;
OpenPOWER on IntegriCloud