aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/sclp_async.c
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2009-10-29 10:04:07 -0400
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2009-10-29 10:05:12 -0400
commit3f0b3c33eeed400577b47fab8439ffe6f40aa97a (patch)
tree42900d693cb11c0df028daed1e17ac499eff1ed7 /drivers/s390/char/sclp_async.c
parent964fe080d94db82a3268443e9b9ece4c60246414 (diff)
[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/char/sclp_async.c')
-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 a4f68e5b9c96..bf4a9f455d8e 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,
68{ 68{
69 unsigned long val; 69 unsigned long val;
70 int len, rc; 70 int len, rc;
71 char buf[2]; 71 char buf[3];
72 72
73 if (!*count | (*ppos && !write)) { 73 if (!*count || (*ppos && !write)) {
74 *count = 0; 74 *count = 0;
75 return 0; 75 return 0;
76 } 76 }
77 if (!write) { 77 if (!write) {
78 len = sprintf(buf, "%d\n", callhome_enabled); 78 len = snprintf(buf, sizeof(buf), "%d\n", callhome_enabled);
79 buf[len] = '\0';
80 rc = copy_to_user(buffer, buf, sizeof(buf)); 79 rc = copy_to_user(buffer, buf, sizeof(buf));
81 if (rc != 0) 80 if (rc != 0)
82 return -EFAULT; 81 return -EFAULT;