Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 917162c9 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Greg Kroah-Hartman
Browse files

tty: return tty->name directly from tty_name



All users of tty_name pass the return value (the provided buffer) to
some printf-like function. We can thus avoid the strcpy and, more
importantly, later remove the buf parameter completely, eliminating
the need for some 64 byte stack buffers.

Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1d6b9877
Loading
Loading
Loading
Loading
+3 −5
Original line number Original line Diff line number Diff line
@@ -235,7 +235,7 @@ static void tty_del_file(struct file *file)
/**
/**
 *	tty_name	-	return tty naming
 *	tty_name	-	return tty naming
 *	@tty: tty structure
 *	@tty: tty structure
 *	@buf: buffer for output
 *	@buf: unused
 *
 *
 *	Convert a tty structure into a name. The name reflects the kernel
 *	Convert a tty structure into a name. The name reflects the kernel
 *	naming policy and if udev is in use may not reflect user space
 *	naming policy and if udev is in use may not reflect user space
@@ -246,10 +246,8 @@ static void tty_del_file(struct file *file)
const char *tty_name(const struct tty_struct *tty, char *buf)
const char *tty_name(const struct tty_struct *tty, char *buf)
{
{
	if (!tty) /* Hmm.  NULL pointer.  That's fun. */
	if (!tty) /* Hmm.  NULL pointer.  That's fun. */
		strcpy(buf, "NULL tty");
		return "NULL tty";
	else
	return tty->name;
		strcpy(buf, tty->name);
	return buf;
}
}


EXPORT_SYMBOL(tty_name);
EXPORT_SYMBOL(tty_name);