Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4914243pxb; Sun, 7 Nov 2021 01:04:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHxteBu6COHFWtZeyqdpBIU2Xo3ByK0JgF29wA1cKm/YLbB8IluWoSLN4kP8AYaTfuDrlq X-Received: by 2002:a05:6e02:20ca:: with SMTP id 10mr32962434ilq.310.1636275851212; Sun, 07 Nov 2021 01:04:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636275851; cv=none; d=google.com; s=arc-20160816; b=oIwur1pXxeh2p3BWA9j9kgM+bCZRBSZzdZeUFHBZWvU8Et0NWySPyQ2i7u1QkwvfGV Spbsm5/MYhWxZMIl1x1UgBzqNXYgoUgCRNejO3YMryq8z6chL5I2Zmw5V++5OwuJTLyI HAuEoCqTOir+jCi+yRf3VH15qZyqG6RPaxTJ/N1YXyTLvSnBZXiHN8+ncywLEnAnQALE upasBjOxSboObATul7FYBSjlhGdDmKNRpNrYgubBJFNlcGB8c4TSOXQPbiy7VKxoJZvd 7gV5Uz0/kPJh5YpBPVDLwKexMf3MlDP7BOUjCUrAld1QUZAOE/iTUKPQXVsp4MN/V/ss fUmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=VAeOOd6OoG8jIe4twgz7nyq7hcVLOkrGdKItQvlZdwg=; b=kI6cldHf4u5e+0A7KXBmcs+shpOvm49/t63kJgSQFvhRjFYBJuvBwGfb/ZvlKV75Uv Y3o3G9SAQGpkyFfOwlXDxsobk/Sw0yRaRISQup1813AHRIW5xuWEOaAKpgt/J5jJR+w4 pW7nMVh9kgQhy2NX1lcEGMjTJYVEYshxsUrXNuKwXIUOjVqHJ7jkT8BtHqelismlPf7T zJ/Ku2r4dQ9rz/XdKjFP8KeLKftzDyzfBP1o7l/FXD0qpqsB6hV3aloud/jJJgFy5W8z M3xXiedYQO6UXzrsuqeHutyoz2hG8G2DQROf+NRxak63psSMiTtWls7xZJuTwAaJi+Fp xd6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K6SCRMoR; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q2si27354991jat.117.2021.11.07.01.03.58; Sun, 07 Nov 2021 01:04:11 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K6SCRMoR; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235076AbhKFUvP (ORCPT + 99 others); Sat, 6 Nov 2021 16:51:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230035AbhKFUvO (ORCPT ); Sat, 6 Nov 2021 16:51:14 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B981C061570; Sat, 6 Nov 2021 13:48:33 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id x27so26364131lfu.5; Sat, 06 Nov 2021 13:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=VAeOOd6OoG8jIe4twgz7nyq7hcVLOkrGdKItQvlZdwg=; b=K6SCRMoR9I6/EMP+kOdrRYbG2L6ciumqh0qEVBwQ6s64fYA5B+SZDadfVS5k60u+9a dJvZSccPGbnTl7nXfS9jROKhM4Zv+GUILLAXxoevkZXiBY6KGAFdoecG9FjVtWqEDZAM 4oghynGPi7S5beX5byO5z327smC7f4Spjq4oUlJWBV7T5P8ihMPQqcV05vZZWHTCp5+u nWy6OzBb5kiNU4R02NLnUtL6oF3imqGu5LbiK9zddWsddu17jd8x/0JpFMDZpGAiZI4H Y4Pzd0NyaFxE2sbqVfIb/u8poY2xP4EV2patorNXSzlqX3OUQEHgfLbJPCPsbJBqM2Vz N/dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=VAeOOd6OoG8jIe4twgz7nyq7hcVLOkrGdKItQvlZdwg=; b=lo31dzBD7ycg5K854Zjaar8apobrpCJtmpcBO60ymvyKKL7pAaS4j6o2QOo1IZyrcY HYYzEg699yjEtT+Dk+Ds7EDl2QXjcGtl+OfFsGXUYMEV9AFvluXwIJA0eeX2O9n9GRql dQUGMvZQroythMgxB6pLFU4SfXfItrnxI29fEMtySJbq19QO9EMAs13lktx8X3qElRBe C7xZruJg6ljWgPqbuUJARdLln5IglIIbw1VjqJW0kQSNjE1vLaJbtNPTtMtfsaDjWH3I xBEfv5AP851hIOU6/0tpjl+W/eA+XkeqqMGW5zKmCw3VKbJG7IY07B3zCUb5Z6C/EGNs If9w== X-Gm-Message-State: AOAM533I74emCuERv7Kfd8FOqOwncidHOkmEnU0k375MR8rA2OFhLmS+ 61gnPHMFzq+6xKSlf5Mbits= X-Received: by 2002:ac2:4a89:: with SMTP id l9mr5405710lfp.679.1636231711339; Sat, 06 Nov 2021 13:48:31 -0700 (PDT) Received: from [192.168.1.11] ([217.117.245.207]) by smtp.gmail.com with ESMTPSA id c3sm594515lfb.122.2021.11.06.13.48.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Nov 2021 13:48:30 -0700 (PDT) Message-ID: <65c45951-08ba-26bb-f96b-3d4442b1d4d4@gmail.com> Date: Sat, 6 Nov 2021 23:48:30 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [PATCH] tty: vt: keyboard: do not copy an extra-byte in copy_to_user Content-Language: en-US To: Ajay Garg Cc: Andy Shevchenko , Greg KH , jirislaby@kernel.org, kernel@esmil.dk, David Laight , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20211106092041.43745-1-ajaygargnsit@gmail.com> <9eafae1f-d9f0-298d-cf20-212865d0becc@gmail.com> <868025b485b94480ad17d0ec971b3ee9@AcuMS.aculab.com> <6b58a3e1-f2ea-cc4c-03b2-06334b559373@gmail.com> <9717b429-597f-7778-c880-94361bcdee7f@gmail.com> From: Pavel Skripkin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/6/21 23:44, Ajay Garg wrote: >> > >> > That's the whole point of the discussion :) >> > >> > The method "vt_do_kdgkb_ioctl" does not manage "func_table[kb_func]". >> > Thus, the method does not know whether or not >> > strlen(func_table[kb_func]) < sizeof(user_kdgkb->kb_string). >> > >> >> It manages. The code under `case KDSKBSENT:` sets func_table[] entries >> via vt_kdskbsent(). >> >> kbs = strndup_user(..., sizeof(user_kdgkb->kb_string)); >> >> is used to allocate buffer for the func_table[] entry. That's my main >> point :) > > func_table is set in vt_kdskbent, which itself is external. > > More importantly, vt_kdskbent is handled in case KDSKBSENT:, while the > strlcpy issue we are dealing with is in case KDGKBSENT: > In case KDGKBSENT, following are managed : > > ssize_t len = sizeof(user_kdgkb->kb_string); > kbs = kmalloc(len, GFP_KERNEL); > > while func_table[kb_func] is external entity here, so no assumption > ought to be made for it, just my 2 cents though :) > > Anyhow, really, it is the maintainers' choice now :), since there > isn't a burning (compilation/runtime) issue. > I fully agree here, it's maintainer's choice. Let's sit down and wait what experienced people thing about this :) I've just wanted to explain my idea better to exclude possible misunderstanding. Thanks With regards, Pavel Skripkin