2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

tty: fix the null pointer of get_tty_driver

v2: split error checking from index variable initialization
v3: use PRIx64 for printing dev_t

Signed-off-by: fu.lin <fulin10@huawei.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
fu.lin 2021-09-17 17:16:48 +08:00 committed by Andrei Vagin
parent 7ba4d3bf1d
commit 485a83c110

View File

@ -1977,6 +1977,12 @@ static int dump_one_tty(int lfd, u32 id, const struct fd_parms *p)
pr_info("Dumping tty %d with id %#x\n", lfd, id);
driver = get_tty_driver(p->stat.st_rdev, p->stat.st_dev);
if (driver == NULL) {
pr_err("Unable to find a tty driver (rdev %#" PRIx64 " dev %#" PRIx64 ")\n", p->stat.st_rdev,
p->stat.st_dev);
return -1;
}
if (driver->fd_get_index)
index = driver->fd_get_index(lfd, p);
else