linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty: audit: remove unused variable
@ 2016-02-23  8:30 Sudip Mukherjee
  2016-02-23 16:00 ` Peter Hurley
  0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2016-02-23  8:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-kernel, Sudip Mukherjee

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

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

* Re: [PATCH] tty: audit: remove unused variable
  2016-02-23  8:30 [PATCH] tty: audit: remove unused variable Sudip Mukherjee
@ 2016-02-23 16:00 ` Peter Hurley
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Hurley @ 2016-02-23 16:00 UTC (permalink / raw)
  To: Sudip Mukherjee, Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-kernel

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);
>  	}
>  }
> 

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

end of thread, other threads:[~2016-02-23 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-23  8:30 [PATCH] tty: audit: remove unused variable Sudip Mukherjee
2016-02-23 16:00 ` Peter Hurley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).