Skip to contentSkip to conversation

tty: audit: remove unused variable

PATCH Superseded Sudip Mukherjee 2 participants 2 messages Feb 23, 2016 TTY layer and serial drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: audit: remove unused variable

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.

---
 drivers/tty/tty_audit.c | 2 --
 1 file changed, 2 deletions(-)
drivers/tty/tty_audit.c +0 -2
index 66d53fc..81fe3fb 100644
@@ -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);
 	}
 }
Signature · 1 line
1.9.1
#1 lore raw

Hi Sudip,

Quoted 5 lines · 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.

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

Quoted 21 lines
---
 drivers/tty/tty_audit.c | 2 --
 1 file changed, 2 deletions(-)
drivers/tty/tty_audit.c +0 -2
index 66d53fc..81fe3fb 100644
@@ -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);
 	}
 }