From patchwork Mon Sep 5 12:24:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 12966052 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 84DB2C6FA83 for ; Mon, 5 Sep 2022 12:25:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E8FC8D007C; Mon, 5 Sep 2022 08:25:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 19A788D0076; Mon, 5 Sep 2022 08:25:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 03A3E8D007C; Mon, 5 Sep 2022 08:25:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E7DED8D0076 for ; Mon, 5 Sep 2022 08:25:56 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C1CDDAAB61 for ; Mon, 5 Sep 2022 12:25:56 +0000 (UTC) X-FDA: 79877953512.01.63878D2 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) by imf27.hostedemail.com (Postfix) with ESMTP id 7353D400B0 for ; Mon, 5 Sep 2022 12:25:56 +0000 (UTC) Received: by mail-ed1-f73.google.com with SMTP id w17-20020a056402269100b0043da2189b71so5640826edd.6 for ; Mon, 05 Sep 2022 05:25:56 -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=Xc6WWErxpVXx0dCndHy1SI9nJ2RkUM6KWSlEnHkZMNXjYMj3eWyaFlYc5HV6uVWOSB E83ahvzmgbb6ZUoBwYvIRsiXbOFt2hZ4fjxwXWmDqsk+RsSu6VyKEnzpdKQoVAg3Pqq0 0CxCR4RVmo8KuqoAF4wGXJy4Xn+lesRq/0h9FAPZBz35/v9WUgk/GXkMNXrt1nuA+y/O IEkkGPOOeNrH3Y57s/Cr5M6o3FEDG8QCVpwR8LkyrdXQzfpKPiEHtVDv3ICpVu9P0YS7 QddzXczkcNwySoyi832F6DuKvJMX2sDo+04A5YYlbMaf1CZbSK6nIYaRflozv//mECLU eOrQ== 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=QzX2vBWm/YEqyJHqxvndruAAN6Y0nFDNO2FzYryBmbBZ+pl6759ZRJrW0YCN/63BjI kNFjlqpedJkcFv1meUhmCSvKmPYmml2QDPCoEEOXlOI3tjCEoTtqKf1/jCq7kwzgSpZp SoJgiGVQYbXmc6GBKuj6RhllexbPE5P21v2ZIr7FmBqoal214rmB2dpsytsqni99nQcT Kb2NsB4CP8Mp1sarvtf01JI5SUEgiJqft3ElLsU6TtrKkyvErSjgLAlAokfJBHZslB4R RAfCERQ2Yt3kPkTPhuJUesJ10DH//ddd0fvTGOiWL7IA3da1/i0PUQxrp0CebSKV0usd H9Qg== X-Gm-Message-State: ACgBeo2vEgU+eXwBg1RuTI5AU9wRJNGjFUZKfMlNpisca9YjP/oHYIeO YH85FWSeIYs1sxM1eUna8VC2Zjn9Fws= X-Google-Smtp-Source: AA6agR5TErPcIF0hILDHYnMq9LaM3xtffYaYn+vk0P64I6LKeQp+A0rabHx9IAlhRIbYZD3eWmQ7V5DKx/g= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:b808:8d07:ab4a:554c]) (user=glider job=sendgmr) by 2002:a17:907:b15:b0:741:8ae4:f79d with SMTP id h21-20020a1709070b1500b007418ae4f79dmr25370696ejl.247.1662380755352; Mon, 05 Sep 2022 05:25:55 -0700 (PDT) Date: Mon, 5 Sep 2022 14:24:29 +0200 In-Reply-To: <20220905122452.2258262-1-glider@google.com> Mime-Version: 1.0 References: <20220905122452.2258262-1-glider@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220905122452.2258262-22-glider@google.com> Subject: [PATCH v6 21/44] 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 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 , 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-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Xc6WWErx; spf=pass (imf27.hostedemail.com: domain of 30-oVYwYKCCACHE9ANCKKCHA.8KIHEJQT-IIGR68G.KNC@flex--glider.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=30-oVYwYKCCACHE9ANCKKCHA.8KIHEJQT-IIGR68G.KNC@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662380756; a=rsa-sha256; cv=none; b=Zc3e3jEFYQ2tQvUFeh0WfrbpmH8YN4lIpnhHtfWhBIVpD+8hAXNPTjQb6G0A/YeTbM4iOQ PEzmOoCiPieoo6GEGbsrEHP3SvcaW4eP8c3jyyHbumIPG/N5bD1deqJ4O7dXI58MA68jj4 S+u9R2pIYmqboRv0UmfrYYgqjsB1kZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662380756; 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=pGamx3HaMoEjXBNMWSPEPqg9TT8gZmfkAmC00YxuZ5hTkYM/G56vPQTSruR2l2PVJrSzhG bgXM8XiI/fEZV+IQRe/hynXJXlwwgHfhuypjkrNo/Pikamkb66rahAe3Obk5jW0o69AVX9 jqQUqSZN+3Jw3EoSbN4g0WmeziUzos4= Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Xc6WWErx; spf=pass (imf27.hostedemail.com: domain of 30-oVYwYKCCACHE9ANCKKCHA.8KIHEJQT-IIGR68G.KNC@flex--glider.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=30-oVYwYKCCACHE9ANCKKCHA.8KIHEJQT-IIGR68G.KNC@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam06 X-Stat-Signature: ickwm7kmwafc4ddg1oyy19oc54jjnt6w X-Rspam-User: X-Rspamd-Queue-Id: 7353D400B0 X-HE-Tag: 1662380756-626157 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)) {