Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1931678pxa; Sat, 29 Aug 2020 08:09:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywS60E30mQ2HPJc3QQjrvDxbGQe4I5yFtrD2qmdhEKd7P+JUpknvjDBULgOlCogcAEBq+s X-Received: by 2002:a17:906:6c99:: with SMTP id s25mr3863833ejr.304.1598713748454; Sat, 29 Aug 2020 08:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598713748; cv=none; d=google.com; s=arc-20160816; b=VZe3rKyyHEyKSfDykaOrMe9GPfF4SJdo6Ie/NTTGKjjLjkTL9Vcxge8R389DAHcn3R t8yzyl67Carfubt+Qg5huPsY+2YlmEeL4truCZ9pHId5AWx8WMqpy+Oksm9TRl1TW2W0 Fkor/Jorpvtd+7mlpbXY4bw4Bv38vX3rcrLTEMBT1zEHb87+mvbtxCnngfAnFp06F/xt +2yo7tlzGGt+sexFxqmm/iCt+saKlWFz4HXV420c2I454pPwc/1WasgFgtdC3sE945Yp lAzGXQJSCbRfPczFVsEXSQUFL3w82vtTImeYofIEc7vFBpKlY/vaUhu4AmHGw8/kfo+Z OgFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=GCqjJubpkghT2AIyQi40Y+N63zR6SKaq4T3Qhf3e3Hg=; b=arWKlA5i/Or+eX+yBYymBTJIBATMy8WFCmQbXh0XLSBfhJWcQzajc2Ft8zzRYKxQdk ntG9/8sBN1dyARfAKM53icKc249+5WjFSKxGyD55GbFUtweGLUAS+ntfUuaDlnl16GAD I/hhcaePtY7ikdvgyx26I4qkobU2C83OdRNUVpxUub+7+ieeP59+d/osst1u3s1KfSNa oz5KDEmPc8Z+UEvC3aC6hDcphanKFk3ZRtZDJzkWpN5NlFuFHglkDiEqY2F6efFnmeQa fZwYpzCVah3jJ4VrzygMhlp9DqV4cP/yuabg5V5AbcTnZ7Vh/6lokGozO3FxyMpo64tg zTfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Et2Ojn4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si1488557edp.241.2020.08.29.08.08.43; Sat, 29 Aug 2020 08:09:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Et2Ojn4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728261AbgH2PIH (ORCPT + 99 others); Sat, 29 Aug 2020 11:08:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727772AbgH2PIF (ORCPT ); Sat, 29 Aug 2020 11:08:05 -0400 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C2D3C061236 for ; Sat, 29 Aug 2020 08:08:05 -0700 (PDT) Received: by mail-oi1-x241.google.com with SMTP id b9so3326238oiy.3 for ; Sat, 29 Aug 2020 08:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GCqjJubpkghT2AIyQi40Y+N63zR6SKaq4T3Qhf3e3Hg=; b=Et2Ojn4hDPJz+Ub9XhEO4HFW1vjyQ+Entu9m1SS54fdlKdgUGT1gTHx7Bbckz09AJK lxgP0AXLc4+uLys/0Ejt4IHoR2ZKA/EIa6vMOVILuYmr9csgOUi/ljb69Emy0js7dp6o zZ6GSFLyn2b/79IBtNTjGibC5opxDYs+JHYFQZeKWnWPaf4VTRL9quzqZjoYiK7bQlov D/w/WVbD0PPdNZ5PfRt9q7KpxaYtBTB9UG4EqwLUfwZF6rUvpCO9ZcHIkhHrrLxa3ZFs 1KiFT4kXPP8tiofbp5KnwdhucNl4v4HgxlLyS6GIzHEMVr0zJaX9DIe8+RHct/Zaf2Wv +uEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=GCqjJubpkghT2AIyQi40Y+N63zR6SKaq4T3Qhf3e3Hg=; b=WspIH84PTmrYn/nMTNi9+myczcQjmqLNC4kGCV+ebImiGmUbmqUM+EZ1C+cWNyO6cn Kv0ElEEzt9xvFCN+i44YAAh5siACDRE1a4K81rQMvGfljheRcTxacO3UEhc2tcbGCGJW THk4iDfFfFvvty/rnbIjqagI43Bf55UR99yEFDApvIIK9WwSBtaaZtofW7RMdNqetq8I 0Zzy3U3mdhGflHMKd5mt+fCAGIi9wib9YUtZUe2YVNkVORmMmPE9KHkkNsCxwn0UMqT1 tmfUIGTa0qHVeIG1XUugWs1QO9FqdX5Dq6BSlHl+WptVrglrRKT6FsK9kDZBtr23M26p wilg== X-Gm-Message-State: AOAM530gXEFhN7ltv9/8sbf5SzWIrBM0XP1WfwsYCOTV7Acl+eLy27z4 HilbkE8rm/J2ilMNMaBiwUc= X-Received: by 2002:a05:6808:204:: with SMTP id l4mr2131952oie.62.1598713684526; Sat, 29 Aug 2020 08:08:04 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id x11sm524069oic.57.2020.08.29.08.08.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Aug 2020 08:08:04 -0700 (PDT) Subject: Re: [PATCH] dmaengine: fsldma: Do not pass pointers to lower_32_bits To: Herbert Xu Cc: Andrew Morton , Linus Torvalds , Linux Kernel Mailing List , Joerg Roedel , Luc Van Oostenryck , Wen He , Peng Ma , Vinod Koul References: <20200828071125.GA18772@gondor.apana.org.au> <20200829105116.GA246533@roeck-us.net> <20200829124535.GA11751@gondor.apana.org.au> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN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Ldertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <5614461b-02ae-5cb5-cca8-0525ffaacc13@roeck-us.net> Date: Sat, 29 Aug 2020 08:08:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200829124535.GA11751@gondor.apana.org.au> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/29/20 5:45 AM, Herbert Xu wrote: > On Sat, Aug 29, 2020 at 03:51:16AM -0700, Guenter Roeck wrote: >> >> This patch results in the following compile error when compiling >> ppc:mpc85xx_defconfig. >> >> Error log: >> In file included from ./include/linux/list.h:9, >> from ./include/linux/module.h:12, >> from drivers/dma/fsldma.c:23: >> drivers/dma/fsldma.h: In function 'fsl_ioread64': >> ./include/linux/kernel.h:189:37: error: invalid operands to binary & (have 'const u64 *' {aka 'const long long unsigned int *'} and 'unsigned int') >> 189 | #define lower_32_bits(n) ((u32)((n) & 0xffffffff)) >> | ^ >> drivers/dma/fsldma.h:208:17: note: in expansion of macro 'lower_32_bits' >> 208 | u32 fsl_addr = lower_32_bits(addr); >> | ^~~~~~~~~~~~~ >> drivers/dma/fsldma.h: In function 'fsl_ioread64be': >> ./include/linux/kernel.h:189:37: error: invalid operands to binary & (have 'const u64 *' {aka 'const long long unsigned int *'} and 'unsigned int') >> 189 | #define lower_32_bits(n) ((u32)((n) & 0xffffffff)) >> | ^ >> drivers/dma/fsldma.h:222:17: note: in expansion of macro 'lower_32_bits' >> 222 | u32 fsl_addr = lower_32_bits(addr); >> | ^~~~~~~~~~~~~ >> make[2]: *** [drivers/dma/fsldma.o] Error 1 > > Thanks for the report. Passing a pointer to lower_32_bits is just > bad. > > ---8<--- > The functions fsl_ioread64* were passing a pointer to lower_32_bits > which just happened to work because it was a macro that simply did > a cast on the argument. > > However, now that lower_32_bits does a mask on the argument it no > longer works. Passing a pointer to lower_32_bits doesn't look > right anyway. > > This patch adds explicit casts so that an integer is passed along > as the argument to lower_32_bits. > > Reported-by: Guenter Roeck > Signed-off-by: Herbert Xu Works as well as the other patch. Tested-by: Guenter Roeck Guenter > > diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h > index 56f18ae99233..da5816b1706e 100644 > --- a/drivers/dma/fsldma.h > +++ b/drivers/dma/fsldma.h > @@ -205,7 +205,7 @@ struct fsldma_chan { > #else > static u64 fsl_ioread64(const u64 __iomem *addr) > { > - u32 fsl_addr = lower_32_bits(addr); > + u32 fsl_addr = lower_32_bits((unsigned long)addr); > u64 fsl_addr_hi = (u64)in_le32((u32 *)(fsl_addr + 1)) << 32; > > return fsl_addr_hi | in_le32((u32 *)fsl_addr); > @@ -219,7 +219,7 @@ static void fsl_iowrite64(u64 val, u64 __iomem *addr) > > static u64 fsl_ioread64be(const u64 __iomem *addr) > { > - u32 fsl_addr = lower_32_bits(addr); > + u32 fsl_addr = lower_32_bits((unsigned long)addr); > u64 fsl_addr_hi = (u64)in_be32((u32 *)fsl_addr) << 32; > > return fsl_addr_hi | in_be32((u32 *)(fsl_addr + 1)); >