From: Paul Moore <paul@paul-moore.com>
To: "Christian Göttsche" <cgzones@googlemail.com>, selinux@vger.kernel.org
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>,
Eric Paris <eparis@parisplace.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 7/9] selinux: avoid implicit conversions in selinuxfs code
Date: Thu, 03 Aug 2023 22:20:22 -0400 [thread overview]
Message-ID: <f37d02a675208bebc7025443e6cd74da.paul@paul-moore.com> (raw)
In-Reply-To: <20230728155501.39632-6-cgzones@googlemail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1644 bytes --]
On Jul 28, 2023 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com> wrote:
>
> Use umode_t as parameter type for sel_make_inode(), which assigns the
> value to the member i_mode of struct inode.
>
> Use identical type for loop iterator.
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> ---
> v2: avoid declarations in init-clauses of for loops
> ---
> security/selinux/selinuxfs.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
> index b969e87fd870..7d7931d1758e 100644
> --- a/security/selinux/selinuxfs.c
> +++ b/security/selinux/selinuxfs.c
...
> @@ -1623,7 +1622,7 @@ static int sel_make_avc_files(struct dentry *dir)
> #endif
> };
>
> - for (i = 0; i < ARRAY_SIZE(files); i++) {
> + for (u32 i = 0; i < ARRAY_SIZE(files); i++) {
No initializers in the for-loop ;)
Also, how did you decide 'i' should be a u32?
> struct inode *inode;
> struct dentry *dentry;
>
> @@ -1649,7 +1648,7 @@ static int sel_make_ss_files(struct dentry *dir)
> {
> struct super_block *sb = dir->d_sb;
> struct selinux_fs_info *fsi = sb->s_fs_info;
> - int i;
> + u32 i;
Same as above, why u32?
> static const struct tree_descr files[] = {
> { "sidtab_hash_stats", &sel_sidtab_hash_stats_ops, S_IRUGO },
> };
> @@ -1700,7 +1699,7 @@ static const struct file_operations sel_initcon_ops = {
>
> static int sel_make_initcon_files(struct dentry *dir)
> {
> - int i;
> + u32 i;
Again, why u32?
> for (i = 1; i <= SECINITSID_NUM; i++) {
> struct inode *inode;
> --
> 2.40.1
--
paul-moore.com
next prev parent reply other threads:[~2023-08-04 2:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 15:54 [PATCH v2 2/9] selinux: use u32 as bit type in ebitmap code Christian Göttsche
2023-07-28 15:54 ` [PATCH v2 3/9] selinux: use identical iterator type in hashtab_duplicate() Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:54 ` [PATCH v2 4/9] selinux: avoid implicit conversions in mls code Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:54 ` [PATCH v2 5/9] selinux: services: update type for number of class permissions Christian Göttsche
2023-07-31 1:46 ` Gong Ruiqi
2023-08-04 2:20 ` Paul Moore
2023-08-04 15:21 ` David Laight
2023-07-28 15:54 ` [PATCH v2 6/9] selinux: avoid implicit conversions in services code Christian Göttsche
2023-07-31 2:01 ` Gong Ruiqi
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:54 ` [PATCH v2 7/9] selinux: avoid implicit conversions in selinuxfs code Christian Göttsche
2023-08-04 2:20 ` Paul Moore [this message]
2023-07-28 15:54 ` [PATCH v2 8/9] selinux: policydb: implicit conversions Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:54 ` [PATCH v2 9/9] selinux: avoid implicit conversion in nlmsgtab code Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:55 ` [PATCH v2 1/9] selinux: avoid implicit conversions in avtab code Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-08-04 2:20 ` [PATCH v2 2/9] selinux: use u32 as bit type in ebitmap code Paul Moore
2023-08-04 15:11 ` David Laight
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=f37d02a675208bebc7025443e6cd74da.paul@paul-moore.com \
--to=paul@paul-moore.com \
--cc=cgzones@googlemail.com \
--cc=eparis@parisplace.org \
--cc=linux-kernel@vger.kernel.org \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/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
all inboxes | Powered by JetHome®