From patchwork Thu Sep 15 15:03:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 12977538 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00D72C6FA8A for ; Thu, 15 Sep 2022 15:05:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6013280008; Thu, 15 Sep 2022 11:05:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58A1380007; Thu, 15 Sep 2022 11:05:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3DC8180008; Thu, 15 Sep 2022 11:05:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2F04E80007 for ; Thu, 15 Sep 2022 11:05:35 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E7BB24015A for ; Thu, 15 Sep 2022 15:05:34 +0000 (UTC) X-FDA: 79914643788.04.56EF93B Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) by imf19.hostedemail.com (Postfix) with ESMTP id 8CBDA1A0094 for ; Thu, 15 Sep 2022 15:05:34 +0000 (UTC) Received: by mail-ed1-f73.google.com with SMTP id e15-20020a056402190f00b0044f41e776a0so13139425edz.0 for ; Thu, 15 Sep 2022 08:05:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=ZKRhstpgJFHnwQb7wa4PSp1fP2zpnAEklrA/+6U+C6A=; b=ThD5yyzHqBsvDfd8Iyv19jyZ2sM12IYTnbGoqnXN5npRxs4Zmln7VoA0117GVlyvP+ L1Rc2EkzfIcjXC3nUcY1fYQ+w1h7v1L8lLr+gl/b+Stf6tF7TTC0ieLLTB5H9+8MJwTV cPTvprpV3Hin238+XDy2bE/nJu/b+H/Bo1Gl9VC7zPy+I29iyDswAthi3+gScTUunW0f D99hzKEENBt+eup4SX3Ru+YBC5gcmF6lpKUFHmW/SZGEqpj0JNmM0Xg4CfE2Gt4d5QDl B5MQFU94qthIy3W4Vl2BeQjxRVxR6rhsIvHEco9D+hMSTS0FjckD4QYWcZtWhUe10Los eI6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=ZKRhstpgJFHnwQb7wa4PSp1fP2zpnAEklrA/+6U+C6A=; b=4Q6pXoNyCBjM7g1Khsbz1knlYM/qGPSPTmex3ImVAPpxqcsbkuhfjP2RW7Q464Zmtt 4ZdpraNPTTZCpxooHJoTPhQTjvOwvERUC6FwKhw8I8MQMGVewPwrigd5+7LjOKFjLVMd wUSFmhItJzHyYP4BsFdj5XKZCkUH3HmxUFuh4z6YEzXtwFzCCPdlg0W6cn7vN7xJl8yW cXfmjt6MSdgcuKaY4nHMvlVumzmNlbm5hvYlahr8lmclJaxvqGFmJzCdZ6NAdnM2BeF5 5nuc6Cp+BjDpofmR4sQ+OJQa0dhQBv3NZzqp2JtH2dgTLbT/MvpJBN7vG+4GRghizSFy i3PQ== X-Gm-Message-State: ACrzQf2c4/3bkNRe/2V5xSJwb+I+KY+A1vE74hZ3DuKXt4sikVrcw2a0 6Qp97FmVydYclyENt4Cdu5VMIG0aenI= X-Google-Smtp-Source: AMsMyM4m3KxavKH5nPSgfXzlvt1xeKFIhjuoRkROmKkrPr/lpTSHT0pnpGf9Q4HdyY1KjTTGhTSnJGDa6K8= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:686d:27b5:495:85b7]) (user=glider job=sendgmr) by 2002:a05:6402:3509:b0:452:20c7:5a95 with SMTP id b9-20020a056402350900b0045220c75a95mr237534edd.427.1663254333337; Thu, 15 Sep 2022 08:05:33 -0700 (PDT) Date: Thu, 15 Sep 2022 17:03:54 +0200 In-Reply-To: <20220915150417.722975-1-glider@google.com> Mime-Version: 1.0 References: <20220915150417.722975-1-glider@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220915150417.722975-21-glider@google.com> Subject: [PATCH v7 20/43] Input: libps2: mark data received in __ps2_command() as initialized From: Alexander Potapenko To: glider@google.com Cc: Alexander Viro , Alexei Starovoitov , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Biggers , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Stephen Rothwell , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663254334; a=rsa-sha256; cv=none; b=gH3nFWZqhvV2Kl1cqKUhjmSBZUMjWVeWKKh6bo4rPQTrxk0CUuH5yS4TF7UTiuHibBXsVh oNl9H3Dn8cnfb2q+TI+MWS/OnirWIP+NnRn5BRY82NrbgLWbPXnDvokmGDmYnGyoQR6Qgt WPSTcfP//C7ahzR27YouJ/LR5qz/Poc= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ThD5yyzH; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of 3PT8jYwYKCGgMROJKXMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--glider.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3PT8jYwYKCGgMROJKXMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--glider.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663254334; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZKRhstpgJFHnwQb7wa4PSp1fP2zpnAEklrA/+6U+C6A=; b=ytuFeOaYmxJqrbEaQol334ixg6K7RZ9raxx45WweFE3SfeosrKRV5cEGDgruW3wUwZcGg0 of+yFWacxSsWzYfVCJUujcuznOOyvfT1Oec7coyPCUiY2/p0vecDUfJ/I9xbIT1CQVK++K 1JgnMCQ0ZYqhQ9Y9BKA7VFDc3fjanT4= X-Stat-Signature: 4zwxe896oskq985y34hatajfxpjzfiah X-Rspamd-Queue-Id: 8CBDA1A0094 X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ThD5yyzH; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of 3PT8jYwYKCGgMROJKXMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--glider.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3PT8jYwYKCGgMROJKXMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--glider.bounces.google.com X-Rspamd-Server: rspam02 X-HE-Tag: 1663254334-763046 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: KMSAN does not know that the device initializes certain bytes in ps2dev->cmdbuf. Call kmsan_unpoison_memory() to explicitly mark them as initialized. Signed-off-by: Alexander Potapenko --- Link: https://linux-review.googlesource.com/id/I2d26f6baa45271d37320d3f4a528c39cb7e545f0 --- drivers/input/serio/libps2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index 250e213cc80c6..3e19344eda93c 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -294,9 +295,11 @@ int __ps2_command(struct ps2dev *ps2dev, u8 *param, unsigned int command) serio_pause_rx(ps2dev->serio); - if (param) + if (param) { for (i = 0; i < receive; i++) param[i] = ps2dev->cmdbuf[(receive - 1) - i]; + kmsan_unpoison_memory(param, receive); + } if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) {