SELinux Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/1] libsepol: initialize a local variable once
@ 2019-07-28 18:37 Nicolas Iooss
  2019-07-28 20:29 ` Ondrej Mosnacek
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Iooss @ 2019-07-28 18:37 UTC (permalink / raw)
  To: selinux

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(-)

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


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

* Re: [PATCH 1/1] libsepol: initialize a local variable once
  2019-07-28 18:37 [PATCH 1/1] libsepol: initialize a local variable once Nicolas Iooss
@ 2019-07-28 20:29 ` Ondrej Mosnacek
  2019-07-30 22:05   ` Nicolas Iooss
  0 siblings, 1 reply; 3+ messages in thread
From: Ondrej Mosnacek @ 2019-07-28 20:29 UTC (permalink / raw)
  To: Nicolas Iooss; +Cc: SElinux list

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
>

-- 
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.

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

* Re: [PATCH 1/1] libsepol: initialize a local variable once
  2019-07-28 20:29 ` Ondrej Mosnacek
@ 2019-07-30 22:05   ` Nicolas Iooss
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Iooss @ 2019-07-30 22:05 UTC (permalink / raw)
  To: Ondrej Mosnacek, SElinux list

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.


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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-28 18:37 [PATCH 1/1] libsepol: initialize a local variable once Nicolas Iooss
2019-07-28 20:29 ` Ondrej Mosnacek
2019-07-30 22:05   ` Nicolas Iooss

SELinux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux/0 selinux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux selinux/ https://lore.kernel.org/selinux \
		selinux@vger.kernel.org selinux@archiver.kernel.org
	public-inbox-index selinux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox