]> git.karo-electronics.de Git - karo-tx-linux.git/commit
oprofilefs: handle zero-length writes
authorMike Waychison <mikew@google.com>
Wed, 28 Sep 2011 00:50:52 +0000 (10:50 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 30 Sep 2011 04:53:43 +0000 (14:53 +1000)
commit9eaf6bcb80b9a6a157448fac9d27b25e233c2399
tree8d0f043b0c9e12bff48937b79da2f250aed33327
parentb5378ecade3ab9495b9628a72c47212095eb32dd
oprofilefs: handle zero-length writes

Currently in oprofilefs, files that use ulong_fops mis-handle writes of
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 <>
drivers/oprofile/oprofilefs.c