Re: [PATCH 2/2] libsemanage: fix optimized compile errors

2017-01-06 Thread James Carter

On 12/23/2016 10:19 AM, Guido Trentalancia wrote:

Fix compile errors when using the "-O -Werror" flags on gcc6.

Signed-off-by: Guido Trentalancia 


Applied.

I changed the log message to the following:

libsemanage: Fix unitialized variable compiler warnings

Fix unitialized variable compiler warnings when using the
"-O -Werror" flags on gcc6 by initializing the variables in
question. It was possible for err_data_len to be used without
initialization, but not cil_data_len.

Thanks,


---
 src/direct_api.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -pru libsemanage-2.6-orig/src/direct_api.c libsemanage-2.6/src/direct_api.c
--- libsemanage-2.6-orig/src/direct_api.c   2016-10-14 17:31:26.0 
+0200
+++ libsemanage-2.6/src/direct_api.c2016-12-23 15:22:50.101297993 +0100
@@ -955,8 +955,8 @@ static int semanage_compile_module(seman
ssize_t bzip_status;
int status = 0;
int compressed;
-   size_t cil_data_len;
-   size_t err_data_len;
+   size_t cil_data_len = 0;
+   size_t err_data_len = 0;

if (!strcasecmp(modinfo->lang_ext, "cil")) {
goto cleanup;
___
Selinux mailing list
Selinux@tycho.nsa.gov
To unsubscribe, send email to selinux-le...@tycho.nsa.gov.
To get help, send an email containing "help" to selinux-requ...@tycho.nsa.gov.




--
James Carter 
National Security Agency
___
Selinux mailing list
Selinux@tycho.nsa.gov
To unsubscribe, send email to selinux-le...@tycho.nsa.gov.
To get help, send an email containing "help" to selinux-requ...@tycho.nsa.gov.


Re: [PATCH 2/2] libsemanage: fix optimized compile errors

2016-12-26 Thread Guido Trentalancia
Hello.

Because of the default compiler flag "-Werror", warnings are treated as
errors and therefore they break the compile process.

It's not a major issue, of course, but it's much better if it is fixed
so that it is not annoying people building with optimization.

I used gcc version 6.2.0. I don't know how other compilers or gcc
versions react to those compiler flags...

Because they have no side-effect, I simply recommend applying the
patches. That's all I can say.

I hope it helps.

On Mon, 26/12/2016 at 21.30 +0100, Nicolas Iooss wrote:
> On Fri, Dec 23, 2016 at 4:19 PM, Guido Trentalancia  ia.net> wrote:
> > Fix compile errors when using the "-O -Werror" flags on gcc6.
> > 
> > Signed-off-by: Guido Trentalancia 
> > ---
> >  src/direct_api.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff -pru libsemanage-2.6-orig/src/direct_api.c libsemanage-
> > 2.6/src/direct_api.c
> > --- libsemanage-2.6-orig/src/direct_api.c       2016-10-14
> > 17:31:26.0 +0200
> > +++ libsemanage-2.6/src/direct_api.c    2016-12-23
> > 15:22:50.101297993 +0100
> > @@ -955,8 +955,8 @@ static int semanage_compile_module(seman
> >         ssize_t bzip_status;
> >         int status = 0;
> >         int compressed;
> > -       size_t cil_data_len;
> > -       size_t err_data_len;
> > +       size_t cil_data_len = 0;
> > +       size_t err_data_len = 0;
> > 
> >         if (!strcasecmp(modinfo->lang_ext, "cil")) {
> >                 goto cleanup;
> 
> Hello,
> From a package maintainer perspective (ie. someone who reads the git
> log in order to find patchs which need to be backported), it would be
> nice if the patch description would state whether this fixes a real
> error which went undetected in the previous releases, or whether this
> silents a false-positive warning from the compiler.
> In this case, gcc is having hard time to find out whether
> semanage_pipe_data() initializes *out_data_len and *err_data_len
> parameters when this function is called by semanage_compile_module().
> So it seems to be a false-positive. If you confirm this analysis and
> send a second revision, could you please add this information to the
> description?
> 
> Cheers,
> Nicolas

Regards,

Guido
___
Selinux mailing list
Selinux@tycho.nsa.gov
To unsubscribe, send email to selinux-le...@tycho.nsa.gov.
To get help, send an email containing "help" to selinux-requ...@tycho.nsa.gov.

Re: [PATCH 2/2] libsemanage: fix optimized compile errors

2016-12-26 Thread Nicolas Iooss
On Fri, Dec 23, 2016 at 4:19 PM, Guido Trentalancia 
wrote:

> Fix compile errors when using the "-O -Werror" flags on gcc6.
>
> Signed-off-by: Guido Trentalancia 
> ---
>  src/direct_api.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff -pru libsemanage-2.6-orig/src/direct_api.c
> libsemanage-2.6/src/direct_api.c
> --- libsemanage-2.6-orig/src/direct_api.c   2016-10-14
> 17:31:26.0 +0200
> +++ libsemanage-2.6/src/direct_api.c2016-12-23 15:22:50.101297993
> +0100
> @@ -955,8 +955,8 @@ static int semanage_compile_module(seman
> ssize_t bzip_status;
> int status = 0;
> int compressed;
> -   size_t cil_data_len;
> -   size_t err_data_len;
> +   size_t cil_data_len = 0;
> +   size_t err_data_len = 0;
>
> if (!strcasecmp(modinfo->lang_ext, "cil")) {
> goto cleanup;
>

Hello,
>From a package maintainer perspective (ie. someone who reads the git log in
order to find patchs which need to be backported), it would be nice if the
patch description would state whether this fixes a real error which went
undetected in the previous releases, or whether this silents a
false-positive warning from the compiler.
In this case, gcc is having hard time to find out whether
semanage_pipe_data() initializes *out_data_len and *err_data_len parameters
when this function is called by semanage_compile_module(). So it seems to
be a false-positive. If you confirm this analysis and send a second
revision, could you please add this information to the description?

Cheers,
Nicolas
___
Selinux mailing list
Selinux@tycho.nsa.gov
To unsubscribe, send email to selinux-le...@tycho.nsa.gov.
To get help, send an email containing "help" to selinux-requ...@tycho.nsa.gov.