All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libsepol: do not use handle when it is marked unused
@ 2017-05-31 20:06 Nicolas Iooss
  2017-05-31 20:06 ` [PATCH 2/2] libsepol: do not mark db as unused when it is used Nicolas Iooss
  2017-06-01 17:00 ` [PATCH 1/2] libsepol: do not use handle when it is marked unused jwcart2
  0 siblings, 2 replies; 4+ messages in thread
From: Nicolas Iooss @ 2017-05-31 20:06 UTC (permalink / raw)
  To: selinux

Assigning NULL to handle does not perform anything useful and clang
complains about this:

    ibendports.c:122:2: error: 'handle' was marked unused but was used
    [-Werror,-Wused-but-marked-unused]
        handle = NULL;
        ^
    ibpkeys.c:115:2: error: 'handle' was marked unused but was used
    [-Werror,-Wused-but-marked-unused]
        handle = NULL;
        ^

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsepol/src/ibendports.c | 1 -
 libsepol/src/ibpkeys.c    | 1 -
 2 files changed, 2 deletions(-)

diff --git a/libsepol/src/ibendports.c b/libsepol/src/ibendports.c
index 0438093e3053..6d56c9a1793f 100644
--- a/libsepol/src/ibendports.c
+++ b/libsepol/src/ibendports.c
@@ -119,7 +119,6 @@ extern int sepol_ibendport_count(sepol_handle_t *handle __attribute__ ((unused))
 
 	*response = count;
 
-	handle = NULL;
 	return STATUS_SUCCESS;
 }
 
diff --git a/libsepol/src/ibpkeys.c b/libsepol/src/ibpkeys.c
index ad6c07fe2c2d..682bf5db210c 100644
--- a/libsepol/src/ibpkeys.c
+++ b/libsepol/src/ibpkeys.c
@@ -112,7 +112,6 @@ extern int sepol_ibpkey_count(sepol_handle_t *handle __attribute__ ((unused)),
 
 	*response = count;
 
-	handle = NULL;
 	return STATUS_SUCCESS;
 }
 
-- 
2.12.2

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

* [PATCH 2/2] libsepol: do not mark db as unused when it is used
  2017-05-31 20:06 [PATCH 1/2] libsepol: do not use handle when it is marked unused Nicolas Iooss
@ 2017-05-31 20:06 ` Nicolas Iooss
  2017-06-01 16:36   ` jwcart2
  2017-06-01 17:00 ` [PATCH 1/2] libsepol: do not use handle when it is marked unused jwcart2
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Iooss @ 2017-05-31 20:06 UTC (permalink / raw)
  To: selinux

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

diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c
index 0a9a5e57491a..7fcee61042c5 100644
--- a/libsepol/cil/src/cil_build_ast.c
+++ b/libsepol/cil/src/cil_build_ast.c
@@ -4256,7 +4256,7 @@ void cil_destroy_filecon(struct cil_filecon *filecon)
 	free(filecon);
 }
 
-int cil_gen_ibpkeycon(__attribute__((unused)) struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
+int cil_gen_ibpkeycon(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
 {
 	enum cil_syntax syntax[] = {
 		CIL_SYN_STRING,
@@ -4667,7 +4667,7 @@ void cil_destroy_netifcon(struct cil_netifcon *netifcon)
 	free(netifcon);
 }
 
-int cil_gen_ibendportcon(__attribute__((unused)) struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
+int cil_gen_ibendportcon(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
 {
 	enum cil_syntax syntax[] = {
 		CIL_SYN_STRING,
-- 
2.12.2

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

* Re: [PATCH 2/2] libsepol: do not mark db as unused when it is used
  2017-05-31 20:06 ` [PATCH 2/2] libsepol: do not mark db as unused when it is used Nicolas Iooss
@ 2017-06-01 16:36   ` jwcart2
  0 siblings, 0 replies; 4+ messages in thread
From: jwcart2 @ 2017-06-01 16:36 UTC (permalink / raw)
  To: Nicolas Iooss, selinux

On 05/31/2017 04:06 PM, Nicolas Iooss wrote:
> ---
>   libsepol/cil/src/cil_build_ast.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c
> index 0a9a5e57491a..7fcee61042c5 100644
> --- a/libsepol/cil/src/cil_build_ast.c
> +++ b/libsepol/cil/src/cil_build_ast.c
> @@ -4256,7 +4256,7 @@ void cil_destroy_filecon(struct cil_filecon *filecon)
>   	free(filecon);
>   }
>   
> -int cil_gen_ibpkeycon(__attribute__((unused)) struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
> +int cil_gen_ibpkeycon(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
>   {
>   	enum cil_syntax syntax[] = {
>   		CIL_SYN_STRING,
> @@ -4667,7 +4667,7 @@ void cil_destroy_netifcon(struct cil_netifcon *netifcon)
>   	free(netifcon);
>   }
>   
> -int cil_gen_ibendportcon(__attribute__((unused)) struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
> +int cil_gen_ibendportcon(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
>   {
>   	enum cil_syntax syntax[] = {
>   		CIL_SYN_STRING,
> 

In both cases, the only use of db is to check that it is not null. Better to 
just remove those checks.

Thanks for the bug report.


-- 
James Carter <jwcart2@tycho.nsa.gov>
National Security Agency

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

* Re: [PATCH 1/2] libsepol: do not use handle when it is marked unused
  2017-05-31 20:06 [PATCH 1/2] libsepol: do not use handle when it is marked unused Nicolas Iooss
  2017-05-31 20:06 ` [PATCH 2/2] libsepol: do not mark db as unused when it is used Nicolas Iooss
@ 2017-06-01 17:00 ` jwcart2
  1 sibling, 0 replies; 4+ messages in thread
From: jwcart2 @ 2017-06-01 17:00 UTC (permalink / raw)
  To: Nicolas Iooss, selinux

On 05/31/2017 04:06 PM, Nicolas Iooss wrote:
> Assigning NULL to handle does not perform anything useful and clang
> complains about this:
> 
>      ibendports.c:122:2: error: 'handle' was marked unused but was used
>      [-Werror,-Wused-but-marked-unused]
>          handle = NULL;
>          ^
>      ibpkeys.c:115:2: error: 'handle' was marked unused but was used
>      [-Werror,-Wused-but-marked-unused]
>          handle = NULL;
>          ^
> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Applied.

Thanks,
Jim

> ---
>   libsepol/src/ibendports.c | 1 -
>   libsepol/src/ibpkeys.c    | 1 -
>   2 files changed, 2 deletions(-)
> 
> diff --git a/libsepol/src/ibendports.c b/libsepol/src/ibendports.c
> index 0438093e3053..6d56c9a1793f 100644
> --- a/libsepol/src/ibendports.c
> +++ b/libsepol/src/ibendports.c
> @@ -119,7 +119,6 @@ extern int sepol_ibendport_count(sepol_handle_t *handle __attribute__ ((unused))
>   
>   	*response = count;
>   
> -	handle = NULL;
>   	return STATUS_SUCCESS;
>   }
>   
> diff --git a/libsepol/src/ibpkeys.c b/libsepol/src/ibpkeys.c
> index ad6c07fe2c2d..682bf5db210c 100644
> --- a/libsepol/src/ibpkeys.c
> +++ b/libsepol/src/ibpkeys.c
> @@ -112,7 +112,6 @@ extern int sepol_ibpkey_count(sepol_handle_t *handle __attribute__ ((unused)),
>   
>   	*response = count;
>   
> -	handle = NULL;
>   	return STATUS_SUCCESS;
>   }
>   
> 


-- 
James Carter <jwcart2@tycho.nsa.gov>
National Security Agency

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

end of thread, other threads:[~2017-06-01 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31 20:06 [PATCH 1/2] libsepol: do not use handle when it is marked unused Nicolas Iooss
2017-05-31 20:06 ` [PATCH 2/2] libsepol: do not mark db as unused when it is used Nicolas Iooss
2017-06-01 16:36   ` jwcart2
2017-06-01 17:00 ` [PATCH 1/2] libsepol: do not use handle when it is marked unused jwcart2

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.