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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 14557C433E0 for ; Thu, 11 Feb 2021 08:04:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 889E564E7C for ; Thu, 11 Feb 2021 08:04:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 889E564E7C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E41846B0092; Thu, 11 Feb 2021 03:04:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF0AF6B0093; Thu, 11 Feb 2021 03:04:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D2D656B0095; Thu, 11 Feb 2021 03:04:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id BE40E6B0092 for ; Thu, 11 Feb 2021 03:04:21 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 85AC7180AD807 for ; Thu, 11 Feb 2021 08:04:21 +0000 (UTC) X-FDA: 77805249522.28.CAA361F Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf18.hostedemail.com (Postfix) with ESMTP id 5437F20001EA for ; Thu, 11 Feb 2021 08:04:20 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 244AE68BFE; Thu, 11 Feb 2021 09:04:17 +0100 (CET) Date: Thu, 11 Feb 2021 09:04:17 +0100 From: Christoph Hellwig To: Anshuman Khandual Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, akpm@linux-foundation.org, will@kernel.org, Robin Murphy , Marek Szyprowski , Christoph Hellwig , David Hildenbrand , Mark Rutland , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] dma-contiguous: Type cast MAX_ORDER as unsigned int Message-ID: <20210211080417.GC14448@lst.de> References: <1613024531-19040-1-git-send-email-anshuman.khandual@arm.com> <1613024531-19040-4-git-send-email-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1613024531-19040-4-git-send-email-anshuman.khandual@arm.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Stat-Signature: xqufhxjxzerixdmudwb58h9p9j43q55e X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5437F20001EA Received-SPF: none (lst.de>: No applicable sender policy available) receiver=imf18; identity=mailfrom; envelope-from=""; helo=verein.lst.de; client-ip=213.95.11.211 X-HE-DKIM-Result: none/none X-HE-Tag: 1613030660-104571 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: On Thu, Feb 11, 2021 at 11:52:11AM +0530, Anshuman Khandual wrote: > Type cast MAX_ORDER as unsigned int to fix the following build warning. >=20 > In file included from ./include/linux/kernel.h:14, > from ./include/asm-generic/bug.h:20, > from ./arch/arm64/include/asm/bug.h:26, > from ./include/linux/bug.h:5, > from ./include/linux/mmdebug.h:5, > from ./arch/arm64/include/asm/memory.h:166, > from ./arch/arm64/include/asm/page.h:42, > from kernel/dma/contiguous.c:46: > kernel/dma/contiguous.c: In function =E2=80=98rmem_cma_setup=E2=80=99: > ./include/linux/minmax.h:18:28: warning: comparison of distinct pointer > types lacks a cast > (!!(sizeof((typeof(x) *)1 =3D=3D (typeof(y) *)1))) > ^~ > ./include/linux/minmax.h:32:4: note: in expansion of macro =E2=80=98__t= ypecheck=E2=80=99 > (__typecheck(x, y) && __no_side_effects(x, y)) > ^~~~~~~~~~~ > ./include/linux/minmax.h:42:24: note: in expansion of macro =E2=80=98__= safe_cmp=E2=80=99 > __builtin_choose_expr(__safe_cmp(x, y), \ > ^~~~~~~~~~ > ./include/linux/minmax.h:58:19: note: in expansion of macro > =E2=80=98__careful_cmp=E2=80=99 > #define max(x, y) __careful_cmp(x, y, >) > ^~~~~~~~~~~~~ > kernel/dma/contiguous.c:402:35: note: in expansion of macro =E2=80=98ma= x=E2=80=99 > phys_addr_t align =3D PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order= ); >=20 > Cc: Christoph Hellwig > Cc: Marek Szyprowski > Cc: Robin Murphy > Cc: iommu@lists.linux-foundation.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > kernel/dma/contiguous.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c > index 3d63d91cba5c..1c2782349d71 100644 > --- a/kernel/dma/contiguous.c > +++ b/kernel/dma/contiguous.c > @@ -399,7 +399,7 @@ static const struct reserved_mem_ops rmem_cma_ops =3D= { > =20 > static int __init rmem_cma_setup(struct reserved_mem *rmem) > { > - phys_addr_t align =3D PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order= ); > + phys_addr_t align =3D PAGE_SIZE << max((unsigned int)MAX_ORDER - 1, p= ageblock_order); MAX_ORDER and pageblock_order should be the same type. So either fix MAX_ORDER to be an unsigned constant, which would be fundamentally the right thing to do but might cause some fallout, or turn pageblock_order into an int, which is probably much either as the stub define of it already has an integer type derived from MAX_ORDER as well.