fs/proc/base.c: fix proc_fault_inject_write() input sanity check
authorVincent Li <macli@brc.ubc.ca>
Tue, 22 Sep 2009 23:45:38 +0000 (16:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Sep 2009 14:39:40 +0000 (07:39 -0700)
commitcba8aafe1e07dfc8bae5ba78be8e02883bd34d31
tree473586963e635921613db5e4ae8ac339ae497a18
parentfb92a4b068be96799da3748c11cbd69760e44d7b
fs/proc/base.c: fix proc_fault_inject_write() input sanity check

Remove obfuscated zero-length input check and return -EINVAL instead of
-EIO error to make the error message clear to user.  Add whitespace
stripping.  No functionality changes.

The old code:

echo  1  > /proc/pid/make-it-fail (ok)
echo 1foo > /proc/pid/make-it-fail (-bash: echo: write error: Input/output error)

The new code:

echo  1  > /proc/pid/make-it-fail (ok)
echo 1foo > /proc/pid/make-it-fail (-bash: echo: write error: Invalid argument)

This patch is conservative in changes to not breaking existing
scripts/applications.

Signed-off-by: Vincent Li <macli@brc.ubc.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/base.c