zero length. A count of 0 causes oprofilefs_ulong_from_user to return 0
(success), which then leads to oprofile_set_ulong being called to stuff
"value" into file->private_data without it being initialized.
Fix this by moving the check for a zero-length write up into
ulong_write_file.
Signed-off-by: Mike Waychison <mikew@google.com>
Cc: Robert Richter <robert.richter@amd.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
char tmpbuf[TMPBUFSIZE];
unsigned long flags;
char tmpbuf[TMPBUFSIZE];
unsigned long flags;
- if (!count)
- return 0;
-
if (count > TMPBUFSIZE - 1)
return -EINVAL;
if (count > TMPBUFSIZE - 1)
return -EINVAL;
if (*offset)
return -EINVAL;
if (*offset)
return -EINVAL;
+ if (count == 0)
+ return 0;
retval = oprofilefs_ulong_from_user(&value, buf, count);
if (retval)
retval = oprofilefs_ulong_from_user(&value, buf, count);
if (retval)