Message ID | 1538966357-3175-1-git-send-email-miles.chen@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tty: check name length in tty_find_polling_driver() | expand |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 5e5da9a..252eef2 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -408,7 +408,7 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line) mutex_lock(&tty_mutex); /* Search through the tty devices to look for a match */ list_for_each_entry(p, &tty_drivers, tty_drivers) { - if (strncmp(name, p->name, len) != 0) + if (!len || strncmp(name, p->name, len) != 0) continue; stp = str; if (*stp == ',')