From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86A38C34022 for ; Wed, 19 Feb 2020 04:54:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 49F8A24656 for ; Wed, 19 Feb 2020 04:54:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WlD3m2Xz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49F8A24656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CA19A6B0003; Tue, 18 Feb 2020 23:54:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C52126B0006; Tue, 18 Feb 2020 23:54:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1ACE6B0007; Tue, 18 Feb 2020 23:54:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id 9380F6B0003 for ; Tue, 18 Feb 2020 23:54:33 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1C79840C3 for ; Wed, 19 Feb 2020 04:54:33 +0000 (UTC) X-FDA: 76505660826.14.watch18_a90bf0beef0d X-HE-Tag: watch18_a90bf0beef0d X-Filterd-Recvd-Size: 5455 Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Feb 2020 04:54:32 +0000 (UTC) Received: by mail-oi1-f196.google.com with SMTP id z2so22579806oih.6 for ; Tue, 18 Feb 2020 20:54:32 -0800 (PST) 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=Os68XGDBUjifyLXJ9YoVcjf5m29kyGwpnUt6cu21Uo4=; b=WlD3m2XzyakcphSWqvY6ufrDPoLiHTqfkDQel1TWzkr4wSIEc8m6I2qtiY+qrLWeU0 g24miItGoafOI1Afqip5txCb4iejvdTbOEcciEI4t2EBCj5h+bH9ZcXAzvN+u3OfKper lHkxw+DTwWmAZjVEJ9pySiYz9LIakW1AssZAbdku//dq8ulQQ6aGSko1ag5vhyO0v3jx +9ixehPaMPDo8W1qU/yf4TdND+x19tPSzYWPvF/V7kJ1uHkDn2m4TiaQTPm6xWdI37dD RyhBWAPc8LYQTGV2ukmDO4AvpZVnmIaw9KdKvw6fkGEK7i4GfP/zjQUWgjm+eEBE+aDn nfCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Os68XGDBUjifyLXJ9YoVcjf5m29kyGwpnUt6cu21Uo4=; b=N6rHyd+UeQw8Tqs4mjWze4O88xJpBJSnStEU9qvKy7YchqHzd68OQvoRVFgNN0702N doQOQek5adtuL6Jqsr4HEPRlH5L2rhIlv7PPiBqupvxCZMe6PnoeYnFkxS3/sbpUt7D6 LtVjbzJQ/5i2CpEfyFFxVRewsJaVMcFwHBvBCOT+Gu2vH92MZYiUyMMh13gPe5KzwiIn n23g2vEae095qFceogGAxYEflA5wImE//RdJ4HPoD2i5p9Bps40egJI6YwScH2gxGycE JfDu/KuVk6bASq6wlsITCIPevareL/iUnH7zAoyiLX7GDV1yZpQC5kSIf7kl7tQVFDKs vQtQ== X-Gm-Message-State: APjAAAVc87BOqhyLZWQSxnpG0tPtrlcpEx5EyRQYUQSkgDoXesy+gY+b BxTVDrjw7w8/mJhOOuqqmkU= X-Google-Smtp-Source: APXvYqxy9VnLpe/f+G1QU6ZpnKmD90vBPbNlWqY9osCEKUE9HSgK6fxs2ivjl+MoiJ1Q8dJ5DNS0zg== X-Received: by 2002:aca:1204:: with SMTP id 4mr3613290ois.143.1582088071777; Tue, 18 Feb 2020 20:54:31 -0800 (PST) Received: from localhost.localdomain ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id c7sm288894otn.81.2020.02.18.20.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 20:54:31 -0800 (PST) From: Nathan Chancellor To: Masahiro Yamada , Michal Marek , Arnd Bergmann , Steven Rostedt , Ingo Molnar , Jason Baron , Catalin Marinas , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, clang-built-linux@googlegroups.com, Nathan Chancellor Subject: [PATCH 0/6] Silence some instances of -Wtautological-compare and enable globally Date: Tue, 18 Feb 2020 21:54:17 -0700 Message-Id: <20200219045423.54190-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: quoted-printable 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: Hi everyone, This patch series aims to silence some instances of clang's -Wtautological-compare that are not problematic and enable it globally for the kernel because it has a bunch of subwarnings that can find real bugs in the kernel such as https://lore.kernel.org/lkml/20200116222658.5285-1-natechancellor@gmail.c= om/ and https://bugs.llvm.org/show_bug.cgi?id=3D42666, which was specifically requested by Dmitry. The first patch adds a macro that casts the section variables to unsigned long (uintptr_t), which silences the warning and adds documentation. Patches two through four silence the warning in the places I have noticed it across all of my builds with -Werror, including arm, arm64, and x86_64 defconfig/allmodconfig/allyesconfig. There might still be more lurking but those will have to be teased out over time. Patch six finally enables the warning, while leaving one of the subwarnings disabled because it is rather noisy and somewhat pointless for the kernel, where core kernel code is expected to build and run with many different configurations where variable types can be different sizes. A slight meta comment: This is the first treewide patchset that I have sent. I pray I did everything right but please let me know if I did not. I assume someone like Andrew will pick this up with acks from everyone but let me know if there is someone better. Cheers, Nathan Nathan Chancellor (6): asm/sections: Add COMPARE_SECTIONS macro kernel/extable: Wrap section comparison in sort_main_extable with COMPARE_SECTIONS tracing: Wrap section comparison in tracer_alloc_buffers with COMPARE_SECTIONS dynamic_debug: Wrap section comparison in dynamic_debug_init with COMPARE_SECTIONS mm: kmemleak: Wrap section comparison in kmemleak_init with COMPARE_SECTIONS kbuild: Enable -Wtautological-compare Makefile | 3 +-- include/asm-generic/sections.h | 7 +++++++ kernel/extable.c | 3 ++- kernel/trace/trace.c | 2 +- lib/dynamic_debug.c | 2 +- mm/kmemleak.c | 3 ++- 6 files changed, 14 insertions(+), 6 deletions(-) base-commit: 02815e777db630e3c183718cab73752b48a5053e --=20 2.25.1