]> git.karo-electronics.de Git - karo-tx-linux.git/commit
oprofilefs: handle zero-length writes
authorMike Waychison <mikew@google.com>
Mon, 24 Oct 2011 14:59:04 +0000 (01:59 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 2 Nov 2011 04:59:15 +0000 (15:59 +1100)
commit77574f96bc3f3236a2b80b8b07b7e7c5d35589ae
tree1b76f5a08d34ade2388c148c15f0e38263803dcb
parentc19d467ac75f032d33bb22cb3c620dd06b431f84
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