From: Cong Wang <amwang@redhat.com>
To: Dan Carpenter <error27.lkml@gmail.com>
Cc: linux-kernel@vger.kernel.org, Eric Paris <eparis@parisplace.org>,
linux-security-module@vger.kernel.org, akpm@linux-foundation.org,
James Morris <jmorris@namei.org>
Subject: Re: [Patch] selinux: remove a useless return
Date: Tue, 08 Dec 2009 17:54:59 +0800 [thread overview]
Message-ID: <4B1E2273.6030706@redhat.com> (raw)
In-Reply-To: <b263e5900912070532i6ab63c36o48030a191c091dd5@mail.gmail.com>
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.
next prev parent reply other threads:[~2009-12-08 9:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2009-12-07 22:26 ` James Morris
2009-12-08 9:55 ` Cong Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B1E2273.6030706@redhat.com \
--to=amwang@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=eparis@parisplace.org \
--cc=error27.lkml@gmail.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox