From patchwork Thu Sep 2 21:57:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12473097 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 53BABC433FE for ; Thu, 2 Sep 2021 21:57:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 23696603E9 for ; Thu, 2 Sep 2021 21:57:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 23696603E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id BF8F76B0133; Thu, 2 Sep 2021 17:57:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA8358D0001; Thu, 2 Sep 2021 17:57:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A975E6B0135; Thu, 2 Sep 2021 17:57:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 9B8666B0133 for ; Thu, 2 Sep 2021 17:57:12 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5BD802BFC5 for ; Thu, 2 Sep 2021 21:57:12 +0000 (UTC) X-FDA: 78543994704.29.916F9B2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf11.hostedemail.com (Postfix) with ESMTP id 1012EF0000AE for ; Thu, 2 Sep 2021 21:57:11 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 086E560F12; Thu, 2 Sep 2021 21:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1630619831; bh=Fl0YsnghtRiidK9h4QnfztRysWxaJOTv5ETAX8kQ4Y4=; h=Date:From:To:Subject:In-Reply-To:From; b=uvhmSlvOcEocuOlOXODqPvfYPZg8p3EyAJT4PtOR/lFvfZIXGeIzt2Dp0L+nLyFdc cfIeXD4wiimpu1NwQifVFwjk06HVwY4O2sZPQ/X5d1QapDm9VJ3114mWQM8gJeHcE5 HHTUdAdH5unwNg2mNgryTfOewpkxaedJkPN8uDOk= Date: Thu, 02 Sep 2021 14:57:10 -0700 From: Andrew Morton To: akpm@linux-foundation.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, rppt@linux.ibm.com, torvalds@linux-foundation.org, willy@infradead.org Subject: [patch 135/212] include/linux/mmzone.h: avoid a warning in sparse memory support Message-ID: <20210902215710.ckzHIoZ99%akpm@linux-foundation.org> In-Reply-To: <20210902144820.78957dff93d7bea620d55a89@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=uvhmSlvO; dmarc=none; spf=pass (imf11.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 1012EF0000AE X-Stat-Signature: ds1oypbuyd1spxsgrinqsasji5bhfmjx X-HE-Tag: 1630619831-785114 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: From: Matthew Wilcox Subject: include/linux/mmzone.h: avoid a warning in sparse memory support cppcheck warns that we're possibly losing information by shifting an int. It's a false positive, because we don't allow for a NUMA node ID that large, but if we ever change SECTION_NID_SHIFT, it could become a problem, and in any case this is usually a legitimate warning. Fix it by adding the necessary cast, which makes the compiler generate the right code. Link: https://lkml.kernel.org/r/YOya+aBZFFmC476e@casper.infradead.org Link: https://lkml.kernel.org/r/202107130348.6LsVT9Nc-lkp@intel.com Cc: Mike Rapoport Signed-off-by: Andrew Morton --- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/sparse.c~avoid-a-warning-in-sparse-memory-support +++ a/mm/sparse.c @@ -117,7 +117,7 @@ static inline int sparse_index_init(unsi */ static inline unsigned long sparse_encode_early_nid(int nid) { - return (nid << SECTION_NID_SHIFT); + return ((unsigned long)nid << SECTION_NID_SHIFT); } static inline int sparse_early_nid(struct mem_section *section)