fs: uselib - Set error on do_filp_open failure only
Subsystems (2)
PATCH 1/1 fs: uselib - Set error on do_filp_open failure only
At present "error" is set irrespective of do_filp_open failed or not. Setting error to PTR_ERR(file) on do_filp_open failure only.
--- fs/exec.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
fs/exec.c +3 -2
@@ -129,9 +129,10 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) file =do_filp_open (AT_FDCWD , tmp, &uselib_flags,LOOKUP_FOLLOW );putname (tmp); - error =PTR_ERR (file); -if (IS_ERR (file)) +if (IS_ERR (file)) { + error =PTR_ERR (file); goto out; + } error = -EINVAL ;if (!S_ISREG (file->f_path.dentry->d_inode->i_mode))
Signature · 1 line
1.7.3.4
Quoted 15 lines · Sasikanth V
At present "error" is set irrespective of
do_filp_openfailed or not. Setting error toPTR_ERR(file)ondo_filp_openfailure only.Signed-off-by Sasikanth V <[email protected]>--- fs/exec.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)fs/exec.c +0
-0@@ -129,9 +129,10 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) file =do_filp_open (AT_FDCWD , tmp, &uselib_flags,LOOKUP_FOLLOW );
fs/exec.c SYSCALL_DEFINE1(uselib, const char __user *, library) · line 138
Quoted 10 lines
fs/exec.c +3
-2putname (tmp); - error =PTR_ERR (file); -if (IS_ERR (file)) +if (IS_ERR (file)) { + error =PTR_ERR (file); goto out; + } error = -EINVAL ;if (!S_ISREG (file->f_path.dentry->d_inode->i_mode))
Ok, maybe I'm just stupid, but I really don't see the point of this patch.
With the original code, if "IS_ERR(file)" is true we'll "goto out" with 'error' set to 'PTR_ERR(file)' and if it is false we'll set 'error = -EINVAL' and continue on...
With your new version we will, as I read the code, "goto out" with "error = PTR_ERR(file)" if "IS_ERR(file)" is true and if it is false we'll set 'error = -EINVAL' and continue.
As I see it, there's no difference, except that your new version adds one extra line to the source file.
Am I missing something (as in "being completely braindead") or??
Signature · 3 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please.
Quoted 2 lines · Sasikanth V
At present "error" is set irrespective of
do_filp_openfailed or not. Setting error toPTR_ERR(file)ondo_filp_openfailure only.
NAK, since it's completely pointless. PTR_ERR() is safe to use on *any* pointers; result won't be anything interesting unless IS_ERR() is true, but PTR_ERR() itself can be evaluated just fine.