* [Patch] selinux: remove a useless return
@ 2009-12-03 8:48 Amerigo Wang
2009-12-03 14:23 ` Eric Paris
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Amerigo Wang @ 2009-12-03 8:48 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Paris, linux-security-module, akpm, Amerigo Wang,
James Morris
The last return is unreachable, remove the 'return'
in default, let it fall through.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: James Morris <jmorris@namei.org>
Cc: Eric Paris <eparis@parisplace.org>
---
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
index b5407f1..718823d 100644
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [Patch] selinux: remove a useless return
2009-12-03 8:48 [Patch] selinux: remove a useless return Amerigo Wang
@ 2009-12-03 14:23 ` Eric Paris
2009-12-07 13:32 ` Dan Carpenter
2009-12-07 22:26 ` James Morris
2 siblings, 0 replies; 6+ messages in thread
From: Eric Paris @ 2009-12-03 14:23 UTC (permalink / raw)
To: Amerigo Wang
Cc: linux-kernel, Eric Paris, linux-security-module, akpm,
James Morris
On Thu, 2009-12-03 at 03:48 -0500, Amerigo Wang wrote:
> The last return is unreachable, remove the 'return'
> in default, let it fall through.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: James Morris <jmorris@namei.org>
> Cc: Eric Paris <eparis@parisplace.org>
Acked-by: Eric Paris <eparis@redhat.com>
>
> ---
>
> diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
> index b5407f1..718823d 100644
> --- a/security/selinux/ss/mls.c
> +++ b/security/selinux/ss/mls.c
> @@ -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;
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Patch] selinux: remove a useless return
2009-12-03 8:48 [Patch] selinux: remove a useless return Amerigo Wang
2009-12-03 14:23 ` Eric Paris
@ 2009-12-07 13:32 ` Dan Carpenter
2009-12-08 9:54 ` Cong Wang
2009-12-07 22:26 ` James Morris
2 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2009-12-07 13:32 UTC (permalink / raw)
To: Amerigo Wang
Cc: linux-kernel, Eric Paris, linux-security-module, akpm,
James Morris
On 12/3/09, Amerigo Wang <amwang@redhat.com> wrote:
> The last return is unreachable, remove the 'return'
> in default, let it fall through.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: James Morris <jmorris@namei.org>
> Cc: Eric Paris <eparis@parisplace.org>
>
> ---
>
> diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
> index b5407f1..718823d 100644
> --- a/security/selinux/ss/mls.c
> +++ b/security/selinux/ss/mls.c
> @@ -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
fi
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).
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Patch] selinux: remove a useless return
2009-12-07 13:32 ` Dan Carpenter
@ 2009-12-08 9:54 ` Cong Wang
0 siblings, 0 replies; 6+ messages in thread
From: Cong Wang @ 2009-12-08 9:54 UTC (permalink / raw)
To: Dan Carpenter
Cc: linux-kernel, Eric Paris, linux-security-module, akpm,
James Morris
Dan Carpenter wrote:
> On 12/3/09, Amerigo Wang <amwang@redhat.com> wrote:
>> The last return is unreachable, remove the 'return'
>> in default, let it fall through.
>>
>> Signed-off-by: WANG Cong <amwang@redhat.com>
>> Cc: James Morris <jmorris@namei.org>
>> Cc: Eric Paris <eparis@parisplace.org>
>>
>> ---
>>
>> diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
>> index b5407f1..718823d 100644
>> --- a/security/selinux/ss/mls.c
>> +++ b/security/selinux/ss/mls.c
>> @@ -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.
Oops, sorry for this, my bad.
Thanks for your patch.
>
> #!/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
> fi
> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Patch] selinux: remove a useless return
2009-12-03 8:48 [Patch] selinux: remove a useless return Amerigo Wang
2009-12-03 14:23 ` Eric Paris
2009-12-07 13:32 ` Dan Carpenter
@ 2009-12-07 22:26 ` James Morris
2009-12-08 9:55 ` Cong Wang
2 siblings, 1 reply; 6+ messages in thread
From: James Morris @ 2009-12-07 22:26 UTC (permalink / raw)
To: Amerigo Wang; +Cc: linux-kernel, Eric Paris, linux-security-module, akpm
On Thu, 3 Dec 2009, Amerigo Wang wrote:
> The last return is unreachable, remove the 'return'
> in default, let it fall through.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: James Morris <jmorris@namei.org>
> Cc: Eric Paris <eparis@parisplace.org>
Applied to
git://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 :-)
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Patch] selinux: remove a useless return
2009-12-07 22:26 ` James Morris
@ 2009-12-08 9:55 ` Cong Wang
0 siblings, 0 replies; 6+ messages in thread
From: Cong Wang @ 2009-12-08 9:55 UTC (permalink / raw)
To: James Morris; +Cc: linux-kernel, Eric Paris, linux-security-module, akpm
James Morris wrote:
> On Thu, 3 Dec 2009, Amerigo Wang wrote:
>
>> The last return is unreachable, remove the 'return'
>> in default, let it fall through.
>>
>> Signed-off-by: WANG Cong <amwang@redhat.com>
>> Cc: James Morris <jmorris@namei.org>
>> Cc: Eric Paris <eparis@parisplace.org>
>
>
> Applied to
> git://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 :-)
>
Right, will be careful, thank you!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-12-08 9:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-03 8:48 [Patch] selinux: remove a useless return Amerigo Wang
2009-12-03 14:23 ` Eric Paris
2009-12-07 13:32 ` Dan Carpenter
2009-12-08 9:54 ` Cong Wang
2009-12-07 22:26 ` James Morris
2009-12-08 9:55 ` Cong Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox