2023-07-06 13:25:26

by Christian Göttsche

[permalink] [raw]
Subject: [RFC PATCH 05/20] selinux: hashtab: use identical iterator type

Use the identical type u32 for the loop iterator.

Signed-off-by: Christian Göttsche <[email protected]>
---
security/selinux/ss/hashtab.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c
index 3fb8f9026e9b..ede3cc1bd204 100644
--- a/security/selinux/ss/hashtab.c
+++ b/security/selinux/ss/hashtab.c
@@ -137,7 +137,7 @@ int hashtab_duplicate(struct hashtab *new, struct hashtab *orig,
void *args)
{
struct hashtab_node *cur, *tmp, *tail;
- int i, rc;
+ int rc;

memset(new, 0, sizeof(*new));

@@ -147,7 +147,7 @@ int hashtab_duplicate(struct hashtab *new, struct hashtab *orig,

new->size = orig->size;

- for (i = 0; i < orig->size; i++) {
+ for (u32 i = 0; i < orig->size; i++) {
tail = NULL;
for (cur = orig->htable[i]; cur; cur = cur->next) {
tmp = kmem_cache_zalloc(hashtab_node_cachep,
@@ -172,7 +172,7 @@ int hashtab_duplicate(struct hashtab *new, struct hashtab *orig,
return 0;

error:
- for (i = 0; i < new->size; i++) {
+ for (u32 i = 0; i < new->size; i++) {
for (cur = new->htable[i]; cur; cur = tmp) {
tmp = cur->next;
destroy(cur->key, cur->datum, args);
--
2.40.1



2023-07-18 22:08:43

by Paul Moore

[permalink] [raw]
Subject: Re: [PATCH RFC 5/20] selinux: hashtab: use identical iterator type

On Jul 6, 2023 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <[email protected]> wrote:
>
> Use the identical type u32 for the loop iterator.
>
> Signed-off-by: Christian Göttsche <[email protected]>
> ---
> security/selinux/ss/hashtab.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)

No to the loop iterators declared in the loop.

--
paul-moore.com