From patchwork Tue Mar 29 12:39:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 12794774 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 3B4B2C433EF for ; Tue, 29 Mar 2022 12:41:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C463D8D0011; Tue, 29 Mar 2022 08:41:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C1D0C8D0010; Tue, 29 Mar 2022 08:41:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0F668D0011; Tue, 29 Mar 2022 08:41:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id 9AB4D8D0010 for ; Tue, 29 Mar 2022 08:41:35 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 58FD78249980 for ; Tue, 29 Mar 2022 12:41:35 +0000 (UTC) X-FDA: 79297384950.17.3878194 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) by imf29.hostedemail.com (Postfix) with ESMTP id 8D038120008 for ; Tue, 29 Mar 2022 12:41:35 +0000 (UTC) Received: by mail-ed1-f74.google.com with SMTP id x5-20020a50ba85000000b00418e8ce90ffso10939000ede.14 for ; Tue, 29 Mar 2022 05:41:34 -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=lsB3lK0aPu+8HWqdJ6/yM1q11PTSMtec/DSdWJ9paXQ=; b=Y2VTXLEBSbXPLu5uhbEKKqB5AO9gIHu9jp/jSny35LuwmGZ+c+hEVtLUWlhSpPVc22 TxOvlY9Yoi7apyfs9Ow6Y9SD8BcLDmBd8zCFsJWqvD1r8+3P/s4FNpxe3VpbUFeGmI1r M2s3smZ8WKAQfLh/zIYUs4yveEnHKHAWaMCHAYZM2EsQtnTEE9sa+vHBJ2c8G01CB99w h+wWzCDc56ZhTweuBlI3h1rdzZJaGibE55vpeLcLzYyMpMH4Nsc8X53WytkodgNs2hJR 4GEA20pYgJcw96lcVe50mTK7DAkc1u2xxRnNcQ3uEduO2cpHhhWmbgpFaG8L9ULcZ04m Xtfw== 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=lsB3lK0aPu+8HWqdJ6/yM1q11PTSMtec/DSdWJ9paXQ=; b=CvVyRqNG4tc5gTV7aVfGQRMJrV3ATi218/pv2TBvYafATj8LOurchp1p7A8uRU6tTq CHznkMCmIquOATulefkqT83q+akmjQtATvQlzFLrM6rvtOmz9/NKO0XKFplU/7LOC1EP dor2/+gCPfKFw4pD/TQ73yre6o+iia3JnNmpszT/w6lrQPoFxJI0uu58eIAycpeFcn5D 78pIFeV4ZbCmhU6807xyh8Yxb1FuhTOwzuEkEmF28lX80DDSJWDSeSiEu7u+e1Mh6DJ6 1tbtu+VPhMq0AktbmFNHu1bf6NAgJp6KkMjVOR6Gz3+ZznoOPBJhPwaxCLRqQml8QuI2 cpTw== X-Gm-Message-State: AOAM5331gGOfnM80qI1nW8mhUTnEMkOOutUzZbNQ6YzDEcSJRDkaaJIt BcscWwNW0e5IqsqxqAwo1UxHcfSLK80= X-Google-Smtp-Source: ABdhPJxMT7rO1P57N71ZmYbIOwRuf4arJokbiW9dyI3uwrKnuskidOOGFTc8VrM1ts4i4n0XHHumgcOFJA8= X-Received: from glider.muc.corp.google.com ([2a00:79e0:15:13:36eb:759:798f:98c3]) (user=glider job=sendgmr) by 2002:a17:906:1ec3:b0:6cf:d118:59e2 with SMTP id m3-20020a1709061ec300b006cfd11859e2mr34473282ejj.767.1648557693731; Tue, 29 Mar 2022 05:41:33 -0700 (PDT) Date: Tue, 29 Mar 2022 14:39:53 +0200 In-Reply-To: <20220329124017.737571-1-glider@google.com> Message-Id: <20220329124017.737571-25-glider@google.com> Mime-Version: 1.0 References: <20220329124017.737571-1-glider@google.com> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog Subject: [PATCH v2 24/48] Input: libps2: mark data received in __ps2_command() as initialized From: Alexander Potapenko To: glider@google.com Cc: Alexander Viro , 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 , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: ycdh4zdhfo35m6zaga4nhknqmxqfz3f7 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Y2VTXLEB; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of 3ff5CYgYKCJ4EJGBCPEMMEJC.AMKJGLSV-KKIT8AI.MPE@flex--glider.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3ff5CYgYKCJ4EJGBCPEMMEJC.AMKJGLSV-KKIT8AI.MPE@flex--glider.bounces.google.com X-Rspamd-Queue-Id: 8D038120008 X-HE-Tag: 1648557695-120215 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)) {