mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
[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>
This commit is contained in:
parent
964fe080d9
commit
3f0b3c33ee
1 changed files with 3 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue