From patchwork Thu May 2 15:35:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10927203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5177714DB for ; Thu, 2 May 2019 15:36:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4051A20134 for ; Thu, 2 May 2019 15:36:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 319CB2018E; Thu, 2 May 2019 15:36:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2AA220134 for ; Thu, 2 May 2019 15:36:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00E586B0008; Thu, 2 May 2019 11:36:08 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F00516B000A; Thu, 2 May 2019 11:36:07 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC93A6B000C; Thu, 2 May 2019 11:36:07 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id 8E0566B0008 for ; Thu, 2 May 2019 11:36:07 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id j3so1253794edb.14 for ; Thu, 02 May 2019 08:36:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:mime-version:content-transfer-encoding; bh=IeCbek7GxN78jmKl6HDSULctY9a079sA8sLhO9KSXCE=; b=jvcGndSwvhKpJrNLGQ3PEN5dhhLaWMgNztR9cJyvy3WJpJ6eQBYBtds3N4//BadTI5 c/mRAF6qqsEjpTmkvCtnT+rlNHCv8uKFln1rsYRJLOctzT8GIWRVfKJG4zrVjyrkJZPA rZk2tGo0mOrt8ytfqa0zDOWyFJpReYzCABbgUYsiTjrRPbRo1NgarGJGGjkXb+0mbT9q b1vmlEeW/B+vZeuMJf9A46Ur6DI20K1D6Sihu3d+SOMWrYZBnQNHxApzv2993joB3qis PSke2NznBO4G9mWi2Vott8McDLspu/iDhaC3OuIo2qpXinzDuInX15bNrVOYhEWhf/pq wdjg== X-Gm-Message-State: APjAAAXrdX/XjAeakp5pJtxYRRwyGIJ6TtjAPows6SrkwhjMeh56+XPB LgTvOlBvWRc0u4h/2H59BagA2tA1rEbVe++dqjBvKWvKpcy7PFe19JJ/qWssga7CEyUEdY5czCZ myro3vEurkdaa9Tbl/DuLu6y/tazddt4HxPmkuF09pr2y1MeeGV9LrQGR1YFLBOJSyw== X-Received: by 2002:a50:89db:: with SMTP id h27mr1210124edh.207.1556811366890; Thu, 02 May 2019 08:36:06 -0700 (PDT) X-Received: by 2002:a50:89db:: with SMTP id h27mr1210068edh.207.1556811365941; Thu, 02 May 2019 08:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556811365; cv=none; d=google.com; s=arc-20160816; b=oQVQd5BesKk+8Czi+lOOBe0E9i7Jw9NshfZSwv+3mMKTisufM88qEnzk1lzuVtr1rK k5tHX48k1qsrP3YEwdQ+kvNqpgsdQbme6KXFRjdUMYPduPcr5T90Ck3P68SQ+VClH77z q2XZ9KVjAJElIm1hxEE+QmvBv4lhnkYQesPCZymKWoxV6KughwFh86gmExNCOpVDD5ZC U8Ve4ruEzPMLLiG9Ily6qOueb9YR02WA3J9h5FOX+KRbMDpqlE4jw2pKcCEjyJHBlfg9 828THRAceG0UimhXWEKpAYq2EAnXHrpoGKTrcSxbMxlxKTQ6bXYnjURWBZUPKms8+irR a0Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=IeCbek7GxN78jmKl6HDSULctY9a079sA8sLhO9KSXCE=; b=lhJcvrr1RwiSnJKmOd/jWYKLzuw2VgVY07lf6gZ9XBX6+8HFaIoXDdENPT2ICnnbLa SpU4uZhxFjzthenaE9M/ZMMsTY0sGEVhEnXgT0T1sz/3vCZYTIjY6N9jJ9jKdhBUUWhw 4bHHQKQ0JMV837FYSMAeeG7wSgDMDtB4m4uR06YjSVV17mPzwoKdZX9rQhrqH2NcMJmx ALWYHQ8V4gnZolxzZ+Aw86kKjpssUgPto9E2HS16N64IUBT2tY3o8jkuAM3KgL1WMICa F4KsY5QqdgO8vIxftWXWyMT6zMDMDR/AL1dGrsad3aQH4keTIIBk/DbcP6HyTdOocy+j 9RVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J04pm3ui; spf=pass (google.com: domain of natechancellor@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=natechancellor@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y25sor4648897edm.9.2019.05.02.08.36.05 for (Google Transport Security); Thu, 02 May 2019 08:36:05 -0700 (PDT) Received-SPF: pass (google.com: domain of natechancellor@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J04pm3ui; spf=pass (google.com: domain of natechancellor@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=natechancellor@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IeCbek7GxN78jmKl6HDSULctY9a079sA8sLhO9KSXCE=; b=J04pm3uinBZj07mQUc20QoDfp+OQk/UzptzIcSRRvJQ+i19xBQyz7UfnOlAK1p63BP 0hBiwZvxaaLGWRcC+VrF0LkpwlOR1UA1i2R3snOKvD7L2UbudEv8MjBkKgtRLhI5AK64 +ajHM23pkTed/0m9GmNqamhAvr7SzAISWxzAKDHmUrK7V7yni2jLai0IAq33C+iJDI5n vys9SsRMh2mmR4MMQ4o/E9FfPT9tqsg1pQgNNbAYJbopon/cuMATXAkju4JdqQI80A8U lE4FFPwdswVeraFDpUWin5auZ+HT9MMpiC8xpByUz81NDaAJFOqUD+QQqbi6NYSx46e+ Ns1A== X-Google-Smtp-Source: APXvYqx2dUlDAJbP5jPeB6xQOpTTqQTTzZYY1NEWzH8taBIya6BsF/hTANqdbRNRRF/OpyE8xQJ/mg== X-Received: by 2002:a50:be01:: with SMTP id a1mr3094467edi.12.1556811365468; Thu, 02 May 2019 08:36:05 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f9:2b:2b84::2]) by smtp.gmail.com with ESMTPSA id e18sm7386693ejf.77.2019.05.02.08.36.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 May 2019 08:36:04 -0700 (PDT) From: Nathan Chancellor To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nick Desaulniers , clang-built-linux@googlegroups.com, Nathan Chancellor Subject: [PATCH] kasan: Zero initialize tag in __kasan_kmalloc Date: Thu, 2 May 2019 08:35:38 -0700 Message-Id: <20190502153538.2326-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Patchwork-Bot: notify 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: X-Virus-Scanned: ClamAV using ClamSMTP When building with -Wuninitialized and CONFIG_KASAN_SW_TAGS unset, Clang warns: mm/kasan/common.c:484:40: warning: variable 'tag' is uninitialized when used here [-Wuninitialized] kasan_unpoison_shadow(set_tag(object, tag), size); ^~~ set_tag ignores tag in this configuration but clang doesn't realize it at this point in its pipeline, as it points to arch_kasan_set_tag as being the point where it is used, which will later be expanded to (void *)(object) without a use of tag. Just zero initialize tag, as it removes this warning and doesn't change the meaning of the code. Link: https://github.com/ClangBuiltLinux/linux/issues/465 Signed-off-by: Nathan Chancellor --- mm/kasan/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 36afcf64e016..4c5af68f2a8b 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -464,7 +464,7 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object, { unsigned long redzone_start; unsigned long redzone_end; - u8 tag; + u8 tag = 0; if (gfpflags_allow_blocking(flags)) quarantine_reduce();