From patchwork Fri Jul 1 14:22:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 12903378 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 A6E2ECCA479 for ; Fri, 1 Jul 2022 14:24:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3FEE36B0078; Fri, 1 Jul 2022 10:24:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AD976B007E; Fri, 1 Jul 2022 10:24:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2753A6B008C; Fri, 1 Jul 2022 10:24:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 18E0B6B0078 for ; Fri, 1 Jul 2022 10:24:16 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0028C612B6 for ; Fri, 1 Jul 2022 14:24:15 +0000 (UTC) X-FDA: 79638750912.14.BD22467 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) by imf30.hostedemail.com (Postfix) with ESMTP id 927148003D for ; Fri, 1 Jul 2022 14:24:15 +0000 (UTC) Received: by mail-ed1-f73.google.com with SMTP id h16-20020a05640250d000b00435bab1a7b4so1893130edb.10 for ; Fri, 01 Jul 2022 07:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=7LZjp1LTGSiY93TRZ3g7FZorW8E9Cp1phv1xqeqiFUY=; b=HUp0QjEtL3POjFsPVmW7Lsr6wHh3uP0c3AIGbejYW5WBVEEA51jhGDXufEvS9+1OoF 4uVyuJc0WeTwbfhCMIs+rmrcOAjTWABoSd8Oaw1teEbFzU0MKdY/z4Slq6iDFA136+6A Dq0ghLvrTYYGXMowWhh/7yEVnmXH6kNFujWdairYknULTqhesx4Yk07JTgMa2g03KfDv ZrTJqfs2WDDcnPD58XjBPdAHHwnHRzjgo5idM+mqSJrORCqZ/jLttEcLx+95oGm5NNfU HQHKB38oaAiXzo52FsKtum2XD5ZN4s5oCz9X6TuacgVJMlaPcY5XhphiQ91hDBCbdhJB tKOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=7LZjp1LTGSiY93TRZ3g7FZorW8E9Cp1phv1xqeqiFUY=; b=USvQ9fUxwSWgc4RIC23VUi6DDz7QYKUg1llxBUzTp+6RHlSj9nAZYFoKDaXMS+KfCl NCQWFBIgFLIust6p7+RrYHgNllVyQ0oKN0d1YrKSPqCpyqUQLXesKOpZd3/AOsE6O9PZ lNxtgnaADOnngMlHogXREy1J4sMF9OdyZT3TrY7KEo+dGHzEqp85Bk3oVWm8LnofqMZp P8pLrVvg7ywSoNF0tMAtQqPHGRUuDH0LmXa6RDZwuJ0PqvIOtdFU9aRPNVjeeLGwvBAR Zg4F37ZUlfM21McYVDZ0+7sgTib9ajrnEcKrVSudvyTg8Dgh99Q0WU4kOhAecNKYXTYP W+oA== X-Gm-Message-State: AJIora8yzsLTtlqa+Q81MwNaOKcSTKuAvpAUftirrhLD33S2hrwmt2ZD SadwQGktjLsUdLwaFZ0k0qREl3YGC8g= X-Google-Smtp-Source: AGRyM1sKIpsY5lY7K78S+NlVsi52z6DpTXM615RMvKRvttRlQPej/Daek4sIgXeLlq3X+zfaa9FMqF7k7ig= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:a6f5:f713:759c:abb6]) (user=glider job=sendgmr) by 2002:a05:6402:4493:b0:435:8dd5:c951 with SMTP id er19-20020a056402449300b004358dd5c951mr18955210edb.289.1656685454405; Fri, 01 Jul 2022 07:24:14 -0700 (PDT) Date: Fri, 1 Jul 2022 16:22:46 +0200 In-Reply-To: <20220701142310.2188015-1-glider@google.com> Message-Id: <20220701142310.2188015-22-glider@google.com> Mime-Version: 1.0 References: <20220701142310.2188015-1-glider@google.com> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog Subject: [PATCH v4 21/45] 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656685455; 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=7LZjp1LTGSiY93TRZ3g7FZorW8E9Cp1phv1xqeqiFUY=; b=5zzP4wY6DurpdlyKD4lI0JawaeHQyP1xj6h+B+LX4cIyo+jwZfzBmMOKo6P8Lv/WTunBJ6 rZ85ZRtczF3CYCBZV4Rpgpwtbv1Z1II27L8NnQg+Oeek2PKfqWxVwiscHr5pzuAycXLjbJ crwYxMo5OH1oyO7gmflvS8xOLonBFaE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656685455; a=rsa-sha256; cv=none; b=tc+jG+5/vA5H2WIu30B1/0bgUCmkieCCoBReCcC1xQdq+deFTpPt5T18IPv7jSB71pjAzL uGpYpIMLov6ivpGFUMS4w09hOrCEze1iBO0zDyKcpZc5U4Nz4hzMQZpbR8Qp6f3eX+ULFR 6T+8Bdj6u4ogkq/oPtW4BvPM51jORQ4= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=HUp0QjEt; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of 3jgO_YgYKCK0TYVQReTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--glider.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3jgO_YgYKCK0TYVQReTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--glider.bounces.google.com X-Stat-Signature: ybkm1st4mkeufws4dt3am3sfgtztdt1f X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=HUp0QjEt; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of 3jgO_YgYKCK0TYVQReTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--glider.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3jgO_YgYKCK0TYVQReTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--glider.bounces.google.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 927148003D X-HE-Tag: 1656685455-508449 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)) {