libsepol: do not use handle when it is marked unused
PATCH 1/2 libsepol: do not use handle when it is marked unused
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 <[email protected]>
--- libsepol/src/ibendports.c | 1 - libsepol/src/ibpkeys.c | 1 - 2 files changed, 2 deletions(-)
libsepol/src/ibendports.c +0 -1
@@ -119,7 +119,6 @@ extern int sepol_ibendport_count(sepol_handle_t *handle __attribute__ ((unused)) *response = count; - handle =NULL ;return STATUS_SUCCESS ; }
libsepol/src/ibpkeys.c +0 -1
@@ -112,7 +112,6 @@ extern int sepol_ibpkey_count(sepol_handle_t *handle __attribute__ ((unused)), *response = count; - handle =NULL ;return STATUS_SUCCESS ; }
Signature · 1 line
2.12.2
PATCH 2/2 libsepol: do not mark db as unused when it is used
--- libsepol/cil/src/cil_build_ast.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
libsepol/cil/src/cil_build_ast.c +2 -2
@@ -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 ,
Signature · 1 line
2.12.2
Re: [PATCH 2/2] libsepol: do not mark db as unused when it is used
Quoted 19 lines · Nicolas Iooss
--- libsepol/cil/src/cil_build_ast.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)libsepol/cil/src/cil_build_ast.c +1
-1@@ -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 ,
libsepol/cil/src/cil_build_ast.c void cil_destroy_netifcon(struct cil_netifcon *netifcon) · line 4673
Quoted 8 lines
libsepol/cil/src/cil_build_ast.c +1
-1@@ -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.
Signature · 2 lines
James Carter <[email protected]> National Security Agency
jwcart2
AppliedQuoted 12 lines · Nicolas Iooss
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; ^
Quoted 1 line
Signed-off-by Nicolas Iooss <[email protected]>
Applied.
Thanks,
Jim
Quoted 30 lines
--- libsepol/src/ibendports.c | 1 - libsepol/src/ibpkeys.c | 1 - 2 files changed, 2 deletions(-)libsepol/src/ibendports.c +0
-1@@ -119,7 +119,6 @@ extern int sepol_ibendport_count(sepol_handle_t *handle __attribute__ ((unused)) *response = count; - handle =NULL ;return STATUS_SUCCESS ; }libsepol/src/ibpkeys.c +0
-1@@ -112,7 +112,6 @@ extern int sepol_ibpkey_count(sepol_handle_t *handle __attribute__ ((unused)), *response = count; - handle =NULL ;return STATUS_SUCCESS ; }
Signature · 2 lines
James Carter <[email protected]> National Security Agency