Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4301629pxj; Wed, 12 May 2021 02:32:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOC5ATUOSjtkC9Ip+TRERL2RVQeejJSq5eaQXr6ifS6JDzMsrC4XXYN3MZjGaBCgQFZYra X-Received: by 2002:a05:6602:3146:: with SMTP id m6mr26178673ioy.158.1620811931069; Wed, 12 May 2021 02:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620811931; cv=none; d=google.com; s=arc-20160816; b=RT14/nOiTuH3q3k3vOMXDIfoDNDqWv0i6uzjXuwliM8FSMDYrn4R5ij3JSG2133Bs2 sxoZlAVZ1Rd8SgEY1NbhlykF0F6K6PBjVoRwDsgQPah7DWFJMA1DngR2MvRHBuUtsPTG zRJY99N460FYaGthkxYiVPkbECeI/NlI138D+WAXJaP1aQk7Y5uNkmCyBYdx2rw6a2O8 8lcspKWlROFAyofNq015KMajc68DPkVRCYb79gYf1gLfjyOt9jlBOPJYTR2syWjAs3yL fpfby/z5jMlsSxFIbE08OCxOUQnKYJiY4GH1H/7fpRFFNrlyWOu6Dt6rs97oWQQi6IH7 7OHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=1nR+2z+N66Y3vCzLzvroOrWCz7T+CB/FcjMmZJkWf80=; b=CpvXGu+uE1GQtSPqJkZUQBnvnR6upPF5+Ccujv5NCVVEdUX8s05bDP/t3hIelpmtEJ plk3uFnUjitpAjGNoWTuRRjITclYxsow5wloRsCqjwxmER7cYsGQUV6aO98VZiZogDuc 73CR4ONwQ1rWBcu3UXoN/xNYo5lrZkZShl/MjKf0pJy/Yijk5SFNhfqjDjNdUgqfY+KX t37+zyRlxVAnMmRJ08YEd4hw1HREsu09O2A45I0CkRyWye77U4G7Jo7JQZFw52+delRQ ZqgNeABHrwjt1/Nbb4Vmx+u1nszzLBvE+c6vYjrHCUoEBboluAjPduWIjUwNGVJRQopk TSPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si21616222ilr.77.2021.05.12.02.31.58; Wed, 12 May 2021 02:32:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230423AbhELJbN (ORCPT + 99 others); Wed, 12 May 2021 05:31:13 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:2645 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbhELJao (ORCPT ); Wed, 12 May 2021 05:30:44 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Fg8Zh6mDfzldZT; Wed, 12 May 2021 17:27:24 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Wed, 12 May 2021 17:29:25 +0800 From: Xiaofei Tan To: , CC: , , Xiaofei Tan Subject: [PATCH 07/17] tty: tty_io: Add a blank line after declarations Date: Wed, 12 May 2021 17:26:15 +0800 Message-ID: <1620811585-18582-8-git-send-email-tanxiaofei@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1620811585-18582-1-git-send-email-tanxiaofei@huawei.com> References: <1620811585-18582-1-git-send-email-tanxiaofei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a blank line after declarations, reported by checkpatch.pl. Signed-off-by: Xiaofei Tan --- drivers/tty/tty_io.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index c5b0e49..8b9430c 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -320,6 +320,7 @@ static struct tty_driver *get_tty_driver(dev_t device, int *index) list_for_each_entry(p, &tty_drivers, tty_drivers) { dev_t base = MKDEV(p->major, p->minor_start); + if (device < base || device >= base + p->num) continue; *index = device - base; @@ -1033,6 +1034,7 @@ static inline ssize_t do_tty_write( /* Do the write .. */ for (;;) { size_t size = count; + if (size > chunk) size = chunk; @@ -1155,6 +1157,7 @@ ssize_t redirected_tty_write(struct kiocb *iocb, struct iov_iter *iter) */ if (p) { ssize_t res; + res = file_tty_write(p, iocb, iter); fput(p); return res; @@ -1942,6 +1945,7 @@ static struct tty_driver *tty_lookup_driver(dev_t device, struct file *filp, #ifdef CONFIG_VT case MKDEV(TTY_MAJOR, 0): { extern struct tty_driver *console_driver; + driver = tty_driver_kref_get(console_driver); *index = fg_console; break; @@ -1949,6 +1953,7 @@ static struct tty_driver *tty_lookup_driver(dev_t device, struct file *filp, #endif case MKDEV(TTYAUX_MAJOR, 1): { struct tty_driver *console_driver = console_device(index); + if (console_driver) { driver = tty_driver_kref_get(console_driver); if (driver && filp) { @@ -2388,6 +2393,7 @@ EXPORT_SYMBOL(tty_do_resize); static int tiocswinsz(struct tty_struct *tty, struct winsize __user *arg) { struct winsize tmp_ws; + if (copy_from_user(&tmp_ws, arg, sizeof(*arg))) return -EFAULT; @@ -2412,6 +2418,7 @@ static int tioccons(struct file *file) return -EPERM; if (file->f_op->write_iter == redirected_tty_write) { struct file *f; + spin_lock(&redirect_lock); f = redirect; redirect = NULL; @@ -2734,6 +2741,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case TIOCGEXCL: { int excl = test_bit(TTY_EXCLUSIVE, &tty->flags); + return put_user(excl, (int __user *)p); } case TIOCGETD: @@ -2748,6 +2756,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case TIOCGDEV: { unsigned int ret = new_encode_dev(tty_devnum(real_tty)); + return put_user(ret, (unsigned int __user *)p); } /* @@ -3103,6 +3112,7 @@ EXPORT_SYMBOL(do_SAK); static struct device *tty_get_device(struct tty_struct *tty) { dev_t devt = tty_devnum(tty); + return class_find_device_by_devt(tty_class, devt); } -- 2.8.1