Discussion:
[PATCH 1/2] selinux: fix build warning by removing the unused sid variable
Corentin Labbe
2017-10-04 18:32:17 UTC
Permalink
This patch remove the unused variable sid
This fix the following build warning:
security/selinux/hooks.c:2921:6: warning: variable 'sid' set but not used [-Wunused-but-set-variable]

Signed-off-by: Corentin Labbe <***@gmail.com>
---
security/selinux/hooks.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index f5d304736852..8507a56f85e4 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2918,13 +2918,12 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir,
{
const struct task_security_struct *tsec = current_security();
struct superblock_security_struct *sbsec;
- u32 sid, newsid, clen;
+ u32 newsid, clen;
int rc;
char *context;

sbsec = dir->i_sb->s_security;

- sid = tsec->sid;
newsid = tsec->create_sid;

rc = selinux_determine_inode_label(current_security(),
--
2.13.6
Corentin Labbe
2017-10-04 18:32:18 UTC
Permalink
This patch make selinux_task_prlimit() static since it is not used
anywhere else.
This fix the following build warning:
security/selinux/hooks.c:3981:5: warning: no previous prototype for 'selinux_task_prlimit' [-Wmissing-prototypes]

Signed-off-by: Corentin Labbe <***@gmail.com>
---
security/selinux/hooks.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 8507a56f85e4..b8a022f4b4a7 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3977,8 +3977,8 @@ static int selinux_task_getioprio(struct task_struct *p)
PROCESS__GETSCHED, NULL);
}

-int selinux_task_prlimit(const struct cred *cred, const struct cred *tcred,
- unsigned int flags)
+static int selinux_task_prlimit(const struct cred *cred, const struct cred *tcred,
+ unsigned int flags)
{
u32 av = 0;
--
2.13.6
Stephen Smalley
2017-10-04 20:27:52 UTC
Permalink
Post by Corentin Labbe
This patch make selinux_task_prlimit() static since it is not used
anywhere else.
security/selinux/hooks.c:3981:5: warning: no previous prototype for
'selinux_task_prlimit' [-Wmissing-prototypes]
---
 security/selinux/hooks.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 8507a56f85e4..b8a022f4b4a7 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3977,8 +3977,8 @@ static int selinux_task_getioprio(struct
task_struct *p)
      PROCESS__GETSCHED, NULL);
 }
 
-int selinux_task_prlimit(const struct cred *cred, const struct cred *tcred,
-  unsigned int flags)
+static int selinux_task_prlimit(const struct cred *cred, const struct cred *tcred,
+ unsigned int flags)
 {
  u32 av = 0;
 
Paul Moore
2017-10-04 20:34:04 UTC
Permalink
Post by Corentin Labbe
This patch make selinux_task_prlimit() static since it is not used
anywhere else.
security/selinux/hooks.c:3981:5: warning: no previous prototype for
'selinux_task_prlimit' [-Wmissing-prototypes]
Merged, thanks again.
--
paul moore
www.paul-moore.com
Stephen Smalley
2017-10-04 20:26:18 UTC
Permalink
Post by Corentin Labbe
This patch remove the unused variable sid
security/selinux/hooks.c:2921:6: warning: variable 'sid' set but not
used [-Wunused-but-set-variable]
---
 security/selinux/hooks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index f5d304736852..8507a56f85e4 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2918,13 +2918,12 @@ static int selinux_inode_init_security(struct
inode *inode, struct inode *dir,
 {
  const struct task_security_struct *tsec =
current_security();
  struct superblock_security_struct *sbsec;
- u32 sid, newsid, clen;
+ u32 newsid, clen;
  int rc;
  char *context;
 
  sbsec = dir->i_sb->s_security;
 
- sid = tsec->sid;
  newsid = tsec->create_sid;
 
  rc = selinux_determine_inode_label(current_security(),
Paul Moore
2017-10-04 20:33:50 UTC
Permalink
Post by Corentin Labbe
This patch remove the unused variable sid
security/selinux/hooks.c:2921:6: warning: variable 'sid' set but not
used [-Wunused-but-set-variable]
Looks good to me too, merged into selinux/next. Thanks.
--
paul moore
www.paul-moore.com
Loading...