diff mbox series

[2/3] libsepol: uniformize prototypes of sepol_mls_contains and sepol_mls_check

Message ID 20210203085846.6680-2-nicolas.iooss@m4x.org (mailing list archive)
State Accepted
Headers show
Series [1/3] libsepol: remove unused files | expand

Commit Message

Nicolas Iooss Feb. 3, 2021, 8:58 a.m. UTC
In libsepol/src/mls.c, functions sepol_mls_contains and sepol_mls_check
used "sepol_policydb_t * policydb" even though
libsepol/include/sepol/context.h used "const sepol_policydb_t *
policydb".

Add const qualifiers in mls.c in order to match the header file. Detect
such mismatching error at compile time by including the header file in
mls.c.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsepol/src/mls.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

James Carter Feb. 4, 2021, 7:26 p.m. UTC | #1
On Wed, Feb 3, 2021 at 4:00 AM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>
> In libsepol/src/mls.c, functions sepol_mls_contains and sepol_mls_check
> used "sepol_policydb_t * policydb" even though
> libsepol/include/sepol/context.h used "const sepol_policydb_t *
> policydb".
>
> Add const qualifiers in mls.c in order to match the header file. Detect
> such mismatching error at compile time by including the header file in
> mls.c.
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libsepol/src/mls.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libsepol/src/mls.c b/libsepol/src/mls.c
> index 1ee90cf8dee1..366a1114ce96 100644
> --- a/libsepol/src/mls.c
> +++ b/libsepol/src/mls.c
> @@ -27,6 +27,7 @@
>   * Implementation of the multi-level security (MLS) policy.
>   */
>
> +#include <sepol/context.h>
>  #include <sepol/policydb/policydb.h>
>  #include <sepol/policydb/services.h>
>  #include <sepol/policydb/context.h>
> @@ -664,7 +665,7 @@ int mls_compute_sid(policydb_t * policydb,
>  }
>
>  int sepol_mls_contains(sepol_handle_t * handle,
> -                      sepol_policydb_t * policydb,
> +                      const sepol_policydb_t * policydb,
>                        const char *mls1, const char *mls2, int *response)
>  {
>
> @@ -703,7 +704,7 @@ int sepol_mls_contains(sepol_handle_t * handle,
>  }
>
>  int sepol_mls_check(sepol_handle_t * handle,
> -                   sepol_policydb_t * policydb, const char *mls)
> +                   const sepol_policydb_t * policydb, const char *mls)
>  {
>
>         int ret;
> --
> 2.30.0
>
Nicolas Iooss Feb. 5, 2021, 9:42 a.m. UTC | #2
On Thu, Feb 4, 2021 at 8:21 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Wed, Feb 3, 2021 at 4:00 AM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
> >
> > In libsepol/src/mls.c, functions sepol_mls_contains and sepol_mls_check
> > used "sepol_policydb_t * policydb" even though
> > libsepol/include/sepol/context.h used "const sepol_policydb_t *
> > policydb".
> >
> > Add const qualifiers in mls.c in order to match the header file. Detect
> > such mismatching error at compile time by including the header file in
> > mls.c.
> >
> > Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
>
> Acked-by: James Carter <jwcart2@gmail.com>

Merged.
Nicolas

> > ---
> >  libsepol/src/mls.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/libsepol/src/mls.c b/libsepol/src/mls.c
> > index 1ee90cf8dee1..366a1114ce96 100644
> > --- a/libsepol/src/mls.c
> > +++ b/libsepol/src/mls.c
> > @@ -27,6 +27,7 @@
> >   * Implementation of the multi-level security (MLS) policy.
> >   */
> >
> > +#include <sepol/context.h>
> >  #include <sepol/policydb/policydb.h>
> >  #include <sepol/policydb/services.h>
> >  #include <sepol/policydb/context.h>
> > @@ -664,7 +665,7 @@ int mls_compute_sid(policydb_t * policydb,
> >  }
> >
> >  int sepol_mls_contains(sepol_handle_t * handle,
> > -                      sepol_policydb_t * policydb,
> > +                      const sepol_policydb_t * policydb,
> >                        const char *mls1, const char *mls2, int *response)
> >  {
> >
> > @@ -703,7 +704,7 @@ int sepol_mls_contains(sepol_handle_t * handle,
> >  }
> >
> >  int sepol_mls_check(sepol_handle_t * handle,
> > -                   sepol_policydb_t * policydb, const char *mls)
> > +                   const sepol_policydb_t * policydb, const char *mls)
> >  {
> >
> >         int ret;
> > --
> > 2.30.0
> >
diff mbox series

Patch

diff --git a/libsepol/src/mls.c b/libsepol/src/mls.c
index 1ee90cf8dee1..366a1114ce96 100644
--- a/libsepol/src/mls.c
+++ b/libsepol/src/mls.c
@@ -27,6 +27,7 @@ 
  * Implementation of the multi-level security (MLS) policy.
  */
 
+#include <sepol/context.h>
 #include <sepol/policydb/policydb.h>
 #include <sepol/policydb/services.h>
 #include <sepol/policydb/context.h>
@@ -664,7 +665,7 @@  int mls_compute_sid(policydb_t * policydb,
 }
 
 int sepol_mls_contains(sepol_handle_t * handle,
-		       sepol_policydb_t * policydb,
+		       const sepol_policydb_t * policydb,
 		       const char *mls1, const char *mls2, int *response)
 {
 
@@ -703,7 +704,7 @@  int sepol_mls_contains(sepol_handle_t * handle,
 }
 
 int sepol_mls_check(sepol_handle_t * handle,
-		    sepol_policydb_t * policydb, const char *mls)
+		    const sepol_policydb_t * policydb, const char *mls)
 {
 
 	int ret;