All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libsepol: Remove unnecessary copying of declarations from link.c
@ 2021-03-11 16:56 James Carter
  2021-03-14 19:54 ` Nicolas Iooss
  0 siblings, 1 reply; 3+ messages in thread
From: James Carter @ 2021-03-11 16:56 UTC (permalink / raw)
  To: selinux; +Cc: James Carter

At one point link_modules() might have needed this initial copying,
but now it serves no purpose, so remove it.

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 libsepol/src/link.c | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/libsepol/src/link.c b/libsepol/src/link.c
index 83bbc8a5..bdc1fcbf 100644
--- a/libsepol/src/link.c
+++ b/libsepol/src/link.c
@@ -2573,36 +2573,6 @@ int link_modules(sepol_handle_t * handle,
 		goto cleanup;
 	}
 
-	/* copy all types, declared and required */
-	for (i = 0; i < len; i++) {
-		state.cur = modules[i];
-		state.cur_mod_name = modules[i]->policy->name;
-		ret =
-		    hashtab_map(modules[i]->policy->p_types.table,
-				type_copy_callback, &state);
-		if (ret) {
-			retval = ret;
-			goto cleanup;
-		}
-	}
-
-	/* then copy everything else, including aliases, and fixup attributes */
-	for (i = 0; i < len; i++) {
-		state.cur = modules[i];
-		state.cur_mod_name = modules[i]->policy->name;
-		ret =
-		    copy_identifiers(&state, modules[i]->policy->symtab, NULL);
-		if (ret) {
-			retval = ret;
-			goto cleanup;
-		}
-	}
-
-	if (policydb_index_others(state.handle, state.base, 0)) {
-		ERR(state.handle, "Error while indexing others");
-		goto cleanup;
-	}
-
 	/* copy and remap the module's data over to base */
 	for (i = 0; i < len; i++) {
 		state.cur = modules[i];
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libsepol: Remove unnecessary copying of declarations from link.c
  2021-03-11 16:56 [PATCH] libsepol: Remove unnecessary copying of declarations from link.c James Carter
@ 2021-03-14 19:54 ` Nicolas Iooss
  2021-03-15 21:08   ` Nicolas Iooss
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Iooss @ 2021-03-14 19:54 UTC (permalink / raw)
  To: James Carter; +Cc: SElinux list

On Thu, Mar 11, 2021 at 5:57 PM James Carter <jwcart2@gmail.com> wrote:
>
> At one point link_modules() might have needed this initial copying,
> but now it serves no purpose, so remove it.
>
> Signed-off-by: James Carter <jwcart2@gmail.com>

Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>

> ---
>  libsepol/src/link.c | 30 ------------------------------
>  1 file changed, 30 deletions(-)
>
> diff --git a/libsepol/src/link.c b/libsepol/src/link.c
> index 83bbc8a5..bdc1fcbf 100644
> --- a/libsepol/src/link.c
> +++ b/libsepol/src/link.c
> @@ -2573,36 +2573,6 @@ int link_modules(sepol_handle_t * handle,
>                 goto cleanup;
>         }
>
> -       /* copy all types, declared and required */
> -       for (i = 0; i < len; i++) {
> -               state.cur = modules[i];
> -               state.cur_mod_name = modules[i]->policy->name;
> -               ret =
> -                   hashtab_map(modules[i]->policy->p_types.table,
> -                               type_copy_callback, &state);
> -               if (ret) {
> -                       retval = ret;
> -                       goto cleanup;
> -               }
> -       }
> -
> -       /* then copy everything else, including aliases, and fixup attributes */
> -       for (i = 0; i < len; i++) {
> -               state.cur = modules[i];
> -               state.cur_mod_name = modules[i]->policy->name;
> -               ret =
> -                   copy_identifiers(&state, modules[i]->policy->symtab, NULL);
> -               if (ret) {
> -                       retval = ret;
> -                       goto cleanup;
> -               }
> -       }
> -
> -       if (policydb_index_others(state.handle, state.base, 0)) {
> -               ERR(state.handle, "Error while indexing others");
> -               goto cleanup;
> -       }
> -
>         /* copy and remap the module's data over to base */
>         for (i = 0; i < len; i++) {
>                 state.cur = modules[i];
> --
> 2.26.2
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libsepol: Remove unnecessary copying of declarations from link.c
  2021-03-14 19:54 ` Nicolas Iooss
@ 2021-03-15 21:08   ` Nicolas Iooss
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Iooss @ 2021-03-15 21:08 UTC (permalink / raw)
  To: James Carter; +Cc: SElinux list

On Sun, Mar 14, 2021 at 8:54 PM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>
> On Thu, Mar 11, 2021 at 5:57 PM James Carter <jwcart2@gmail.com> wrote:
> >
> > At one point link_modules() might have needed this initial copying,
> > but now it serves no purpose, so remove it.
> >
> > Signed-off-by: James Carter <jwcart2@gmail.com>
>
> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Merged.

Thanks!
Nicolas

> > ---
> >  libsepol/src/link.c | 30 ------------------------------
> >  1 file changed, 30 deletions(-)
> >
> > diff --git a/libsepol/src/link.c b/libsepol/src/link.c
> > index 83bbc8a5..bdc1fcbf 100644
> > --- a/libsepol/src/link.c
> > +++ b/libsepol/src/link.c
> > @@ -2573,36 +2573,6 @@ int link_modules(sepol_handle_t * handle,
> >                 goto cleanup;
> >         }
> >
> > -       /* copy all types, declared and required */
> > -       for (i = 0; i < len; i++) {
> > -               state.cur = modules[i];
> > -               state.cur_mod_name = modules[i]->policy->name;
> > -               ret =
> > -                   hashtab_map(modules[i]->policy->p_types.table,
> > -                               type_copy_callback, &state);
> > -               if (ret) {
> > -                       retval = ret;
> > -                       goto cleanup;
> > -               }
> > -       }
> > -
> > -       /* then copy everything else, including aliases, and fixup attributes */
> > -       for (i = 0; i < len; i++) {
> > -               state.cur = modules[i];
> > -               state.cur_mod_name = modules[i]->policy->name;
> > -               ret =
> > -                   copy_identifiers(&state, modules[i]->policy->symtab, NULL);
> > -               if (ret) {
> > -                       retval = ret;
> > -                       goto cleanup;
> > -               }
> > -       }
> > -
> > -       if (policydb_index_others(state.handle, state.base, 0)) {
> > -               ERR(state.handle, "Error while indexing others");
> > -               goto cleanup;
> > -       }
> > -
> >         /* copy and remap the module's data over to base */
> >         for (i = 0; i < len; i++) {
> >                 state.cur = modules[i];
> > --
> > 2.26.2
> >


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-15 21:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 16:56 [PATCH] libsepol: Remove unnecessary copying of declarations from link.c James Carter
2021-03-14 19:54 ` Nicolas Iooss
2021-03-15 21:08   ` Nicolas Iooss

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.