Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1340397 > unrolled thread

[PATCH] tty: audit: remove unused variable

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2016-02-23 09:40 +0100
Last post2016-02-23 17:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tty: audit: remove unused variable Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-23 09:40 +0100
    Re: [PATCH] tty: audit: remove unused variable Peter Hurley <peter@hurleysoftware.com> - 2016-02-23 17:10 +0100

#1340397 — [PATCH] tty: audit: remove unused variable

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2016-02-23 09:40 +0100
Subject[PATCH] tty: audit: remove unused variable
Message-ID<r5gFI-2J4-3@gated-at.bofh.it>
While building with W=1 we were getting build warning:
drivers/tty/tty_audit.c:149:16: warning: variable 'sessionid' set but not used

The local variable sessionid was only assigned the value of
current->sessionid but was never reused.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
 drivers/tty/tty_audit.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index 66d53fc..81fe3fb 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -146,10 +146,8 @@ void tty_audit_tiocsti(struct tty_struct *tty, char ch)
 
 	if (audit_enabled) {
 		kuid_t auid;
-		unsigned int sessionid;
 
 		auid = audit_get_loginuid(current);
-		sessionid = audit_get_sessionid(current);
 		tty_audit_log("ioctl=TIOCSTI", dev, &ch, 1);
 	}
 }
-- 
1.9.1

[toc] | [next] | [standalone]


#1340813

FromPeter Hurley <peter@hurleysoftware.com>
Date2016-02-23 17:10 +0100
Message-ID<r5nHb-7N8-5@gated-at.bofh.it>
In reply to#1340397
Hi Sudip,

On 02/23/2016 12:30 AM, Sudip Mukherjee wrote:
> While building with W=1 we were getting build warning:
> drivers/tty/tty_audit.c:149:16: warning: variable 'sessionid' set but not used
> 
> The local variable sessionid was only assigned the value of
> current->sessionid but was never reused.

Thanks for catching this.

While reviewing this patch, I noticed entire if clause can be reduced to

	if (audit_enabled)
		tty_audit_log("ioctl=TIOCSTI", dev, &ch, 1);

since auid is unused variable as well.

Regards,
Peter Hurley


> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
>  drivers/tty/tty_audit.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
> index 66d53fc..81fe3fb 100644
> --- a/drivers/tty/tty_audit.c
> +++ b/drivers/tty/tty_audit.c
> @@ -146,10 +146,8 @@ void tty_audit_tiocsti(struct tty_struct *tty, char ch)
>  
>  	if (audit_enabled) {
>  		kuid_t auid;
> -		unsigned int sessionid;
>  
>  		auid = audit_get_loginuid(current);
> -		sessionid = audit_get_sessionid(current);
>  		tty_audit_log("ioctl=TIOCSTI", dev, &ch, 1);
>  	}
>  }
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web