]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
oprofilefs: handle zero-length writes
authorMike Waychison <mikew@google.com>
Wed, 5 Oct 2011 00:43:42 +0000 (11:43 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 13 Oct 2011 06:49:54 +0000 (17:49 +1100)
commit2568923c43c7eb8a4b1bb9d50c34daca54f1200c
tree78808300f9ff72f92e06d4afc732c6e20e027519
parent4f72a0e808e14dfc58fb8f5ca0731aa936da500d
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 <akpm@linux-foundation.org>
drivers/oprofile/oprofilefs.c