From patchwork Tue Sep 29 10:59:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290855 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=-18.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 2440EC4727C for ; Tue, 29 Sep 2020 12:22:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C97AF2076A for ; Tue, 29 Sep 2020 12:22:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601382171; bh=NM+pV2xFne5voKMEuTRmE4BSRip2u7Hd2NQ0ApveeOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gHlniuwKEQhidtxKUWmMN/bl6lFqgUmoPS7bl40VOVHAH9ToREfEsQxuLX/SM0acS 1ebQF/bDgcby3JRRs5KSntj6FOEvfIeM8ak2PPvwNuNJPYZuvuWjWQOdHAG35h8ZN4 fgH1gSFVtokG12XgZo/QpsoaMUUQXvycdWqNcS7Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732565AbgI2MWg (ORCPT ); Tue, 29 Sep 2020 08:22:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:50296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729796AbgI2LfL (ORCPT ); Tue, 29 Sep 2020 07:35:11 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5CDB523C30; Tue, 29 Sep 2020 11:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378895; bh=NM+pV2xFne5voKMEuTRmE4BSRip2u7Hd2NQ0ApveeOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VZlOFXGdDnmuCgUvdX+kuXY5pUQZ7Ou6eUt8GhMCIWZzCuRI8ql/DTi0whrnfWmRN IWOwbThScNbU8I2yZMX9OmGpOnMMSpAyHQxr6Jo/hqMF4y495z6CiQBQ5GfBYj4/Cp eQR1RT6jdhWM/ce7CDqiVX/PTU/cWSI3kepY8mtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Desaulniers , Nathan Chancellor , Andrew Morton , Catalin Marinas , Linus Torvalds , Sasha Levin Subject: [PATCH 4.19 138/245] mm/kmemleak.c: use address-of operator on section symbols Date: Tue, 29 Sep 2020 12:59:49 +0200 Message-Id: <20200929105953.706085907@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nathan Chancellor [ Upstream commit b0d14fc43d39203ae025f20ef4d5d25d9ccf4be1 ] Clang warns: mm/kmemleak.c:1955:28: warning: array comparison always evaluates to a constant [-Wtautological-compare] if (__start_ro_after_init < _sdata || __end_ro_after_init > _edata) ^ mm/kmemleak.c:1955:60: warning: array comparison always evaluates to a constant [-Wtautological-compare] if (__start_ro_after_init < _sdata || __end_ro_after_init > _edata) These are not true arrays, they are linker defined symbols, which are just addresses. Using the address of operator silences the warning and does not change the resulting assembly with either clang/ld.lld or gcc/ld (tested with diff + objdump -Dr). Suggested-by: Nick Desaulniers Signed-off-by: Nathan Chancellor Signed-off-by: Andrew Morton Acked-by: Catalin Marinas Link: https://github.com/ClangBuiltLinux/linux/issues/895 Link: http://lkml.kernel.org/r/20200220051551.44000-1-natechancellor@gmail.com Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/kmemleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 5eeabece0c178..f54734abf9466 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -2039,7 +2039,7 @@ void __init kmemleak_init(void) create_object((unsigned long)__bss_start, __bss_stop - __bss_start, KMEMLEAK_GREY, GFP_ATOMIC); /* only register .data..ro_after_init if not within .data */ - if (__start_ro_after_init < _sdata || __end_ro_after_init > _edata) + if (&__start_ro_after_init < &_sdata || &__end_ro_after_init > &_edata) create_object((unsigned long)__start_ro_after_init, __end_ro_after_init - __start_ro_after_init, KMEMLEAK_GREY, GFP_ATOMIC);