]> 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>
Fri, 4 Nov 2011 04:48:21 +0000 (15:48 +1100)
commit09a85bbf48436f9a0f7b72d0b2dc51190cbcf753
tree7a0d55e10036fe2221fb68b429fcdeb684179547
parent0310f983b36f9e7fd8dac3bf9d0a371fcdcdff67
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