]> 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>
Mon, 7 Nov 2011 02:40:30 +0000 (13:40 +1100)
commitcfbbce01937569e1ae17fc59556de9bced8e668b
tree7cee0c700a6ff0e887c4e578763beffe0c70f025
parent376ec0dc69fa5d18636c6568ab8152b12689f1aa
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