selinux: remove a useless return
PATCH 1/1 selinux: remove a useless return
The last return is unreachable, remove the 'return' in default, let it fall through.
---
security/selinux/ss/mls.c +1 -1
@@ -542,7 +542,7 @@ int mls_compute_sid(struct context *scontext,/* Use the process effective MLS attributes. */ return mls_context_cpy_low (newcontext, scontext);default : -return -EINVAL ; +/* Fallthrough */ }return -EINVAL ; }
Quoted 6 lines · Amerigo Wang
The last return is unreachable, remove the 'return' in default, let it fall through.
Signed-off-by WANG Cong <[email protected]>Cc James Morris <[email protected]>Cc Eric Paris <[email protected]>
Quoted 16 lines
---
security/selinux/ss/mls.c +1
-1@@ -542,7 +542,7 @@ int mls_compute_sid(struct context *scontext,/* Use the process effective MLS attributes. */ return mls_context_cpy_low (newcontext, scontext);default : -return -EINVAL ; +/* Fallthrough */ }return -EINVAL ; }
Quoted 14 lines · Amerigo Wang
The last return is unreachable, remove the 'return' in default, let it fall through.
Signed-off-by WANG Cong <[email protected]>Cc James Morris <[email protected]>Cc Eric Paris <[email protected]>---
security/selinux/ss/mls.c +0
-0
security/selinux/ss/mls.c int mls_compute_sid(struct context *scontext, · line 548
Quoted 8 lines
security/selinux/ss/mls.c +1
-1@@ -542,7 +542,7 @@ int mls_compute_sid(struct context *scontext,/* Use the process effective MLS attributes. */ return mls_context_cpy_low (newcontext, scontext);default : -return -EINVAL ; +/* Fallthrough */ }return -EINVAL ; }
I don't think this compiles. GCC doesn't let you end a switch block with a label.
I also have sent the selinux people a patch that didn't compile by mistake. Afterward I wrote this script so hopefully I won't mess up again.
#!/bin/bash -e
files=$(grep +++ /home/dcarpenter/var/mail/postponed-msgs | cut -f 1 | cut -b 5-)
for file in $files ; do
file=${file/devel\//}
file=${file/new\//}
kchecker $file
if which sparse | grep -q sparse ; then
kchecker --sparse $file
fidone
You will have to change the path names. Hm.... Also you will have to get the kchecker script from the smatch_data/ directory of smatch
(http://repo.or.cz/w/smatch.git).
regards,
dan carpenter
Quoted 27 lines · Dan Carpenter
Quoted 14 lines · Amerigo Wang
The last return is unreachable, remove the 'return' in default, let it fall through.
Signed-off-by WANG Cong <[email protected]>Cc James Morris <[email protected]>Cc Eric Paris <[email protected]>---
security/selinux/ss/mls.c +0
-0security/selinux/ss/mls.c int mls_compute_sid(struct context *scontext, · line 548
Quoted 8 lines
security/selinux/ss/mls.c +1
-1@@ -542,7 +542,7 @@ int mls_compute_sid(struct context *scontext,/* Use the process effective MLS attributes. */ return mls_context_cpy_low (newcontext, scontext);default : -return -EINVAL ; +/* Fallthrough */ }return -EINVAL ; }I don't think this compiles. GCC doesn't let you end a switch block with a label.
Quoted 3 lines
I also have sent the selinux people a patch that didn't compile by mistake. Afterward I wrote this script so hopefully I won't mess up again.
Oops, sorry for this, my bad.
Thanks for your patch.
Quoted 12 lines
#!/bin/bash -e
files=$(grep +++
/home/dcarpenter/var/mail/postponed-msgs| cut -f 1 | cut -b 5-)
for file in $files ; dofile=${file/devel\//} file=${file/new\//} kchecker $file if which sparse | grep -q sparse ; then kchecker --sparse $file fi
Quoted 6 lines
done
You will have to change the path names. Hm.... Also you will have to get the kchecker script from the smatch_data/ directory of smatch
(http://repo.or.cz/w/smatch.git).
Thanks for the info! I will have a try.
Quoted 6 lines · Amerigo Wang
The last return is unreachable, remove the 'return' in default, let it fall through.
Signed-off-by WANG Cong <[email protected]>Cc James Morris <[email protected]>Cc Eric Paris <[email protected]>
Applied togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
with a fixup for the problem reported by Dan Carpenter.
You should not send out patches without testing them, even when following the advice of the person you're sending them to :-)
Signature · 2 lines
James Morris <[email protected]>
Quoted 10 lines · James Morris
Quoted 6 lines · Amerigo Wang
The last return is unreachable, remove the 'return' in default, let it fall through.
Signed-off-by WANG Cong <[email protected]>Cc James Morris <[email protected]>Cc Eric Paris <[email protected]>
Quoted 7 lines
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#nextwith a fixup for the problem reported by Dan Carpenter.
You should not send out patches without testing them, even when following the advice of the person you're sending them to :-)
Right, will be careful, thank you!