]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
oprofilefs: handle zero-length writes
authorMike Waychison <mikew@google.com>
Tue, 8 Nov 2011 00:20:19 +0000 (11:20 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 8 Nov 2011 03:25:28 +0000 (14:25 +1100)
commitadb916f953708f85c5701dcf90c641c0ec863906
treecdfdd0b845ef819336bb4ceb997441dcbab3e2be
parentcc6b74c7d77c228cc081904b2e8e330dc886358f
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