]> git.karo-electronics.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>
Tue, 11 Oct 2011 08:44:08 +0000 (19:44 +1100)
commitc8230546969b00424513fd90c63884e75df44695
tree1ed8bef64bbf5c677664f0714791ca22405d7a7b
parentbf09cb895d7a8104d1ff5ac2fb7b3edf09fcf8e1
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