diff mbox series

[1/1] libsepol: initialize a local variable once

Message ID 20190728183749.30044-1-nicolas.iooss@m4x.org (mailing list archive)
State Accepted
Headers show
Series [1/1] libsepol: initialize a local variable once | expand

Commit Message

Nicolas Iooss July 28, 2019, 6:37 p.m. UTC
Function optimize_cond_av_list() initializes its local variable pcov_cur
twice. Remove the first initialization.

This issue has been found using clang's static analyzer:
https://282-118970575-gh.circle-artifacts.com/0/output-scan-build/2019-06-24-210510-6101-1/report-c64da3.html#EndPath

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsepol/src/optimize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ondrej Mosnacek July 28, 2019, 8:29 p.m. UTC | #1
On Sun, Jul 28, 2019 at 8:38 PM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
> Function optimize_cond_av_list() initializes its local variable pcov_cur
> twice. Remove the first initialization.
>
> This issue has been found using clang's static analyzer:
> https://282-118970575-gh.circle-artifacts.com/0/output-scan-build/2019-06-24-210510-6101-1/report-c64da3.html#EndPath
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Acked-by: Ondrej Mosnacek <omosnace@redhat.com>

> ---
>  libsepol/src/optimize.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libsepol/src/optimize.c b/libsepol/src/optimize.c
> index 3780b68b24fe..10399a43e1cf 100644
> --- a/libsepol/src/optimize.c
> +++ b/libsepol/src/optimize.c
> @@ -247,7 +247,7 @@ static void optimize_cond_av_list(cond_av_list_t **cond, cond_av_list_t **del,
>  {
>         cond_av_list_t **listp = cond;
>         cond_av_list_t *pcov = NULL;
> -       cond_av_list_t **pcov_cur = &pcov;
> +       cond_av_list_t **pcov_cur;
>
>         /*
>          * Separate out all "potentially covering" rules (src or tgt is an attr)
> --
> 2.22.0
>
Nicolas Iooss July 30, 2019, 10:05 p.m. UTC | #2
On Sun, Jul 28, 2019 at 10:29 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> On Sun, Jul 28, 2019 at 8:38 PM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
> > Function optimize_cond_av_list() initializes its local variable pcov_cur
> > twice. Remove the first initialization.
> >
> > This issue has been found using clang's static analyzer:
> > https://282-118970575-gh.circle-artifacts.com/0/output-scan-build/2019-06-24-210510-6101-1/report-c64da3.html#EndPath
> >
> > Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
>
> Acked-by: Ondrej Mosnacek <omosnace@redhat.com>

Thanks, merged.

Nicolas

> > ---
> >  libsepol/src/optimize.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libsepol/src/optimize.c b/libsepol/src/optimize.c
> > index 3780b68b24fe..10399a43e1cf 100644
> > --- a/libsepol/src/optimize.c
> > +++ b/libsepol/src/optimize.c
> > @@ -247,7 +247,7 @@ static void optimize_cond_av_list(cond_av_list_t **cond, cond_av_list_t **del,
> >  {
> >         cond_av_list_t **listp = cond;
> >         cond_av_list_t *pcov = NULL;
> > -       cond_av_list_t **pcov_cur = &pcov;
> > +       cond_av_list_t **pcov_cur;
> >
> >         /*
> >          * Separate out all "potentially covering" rules (src or tgt is an attr)
> > --
> > 2.22.0
> >
>
> --
> Ondrej Mosnacek <omosnace at redhat dot com>
> Software Engineer, Security Technologies
> Red Hat, Inc.
diff mbox series

Patch

diff --git a/libsepol/src/optimize.c b/libsepol/src/optimize.c
index 3780b68b24fe..10399a43e1cf 100644
--- a/libsepol/src/optimize.c
+++ b/libsepol/src/optimize.c
@@ -247,7 +247,7 @@  static void optimize_cond_av_list(cond_av_list_t **cond, cond_av_list_t **del,
 {
 	cond_av_list_t **listp = cond;
 	cond_av_list_t *pcov = NULL;
-	cond_av_list_t **pcov_cur = &pcov;
+	cond_av_list_t **pcov_cur;
 
 	/*
 	 * Separate out all "potentially covering" rules (src or tgt is an attr)