mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	benh@kernel.crashing.org, davem@davemloft.net
Subject: Re: [PATCH] iommu-common: Do not use 64 bit  constant 0xffffffffffffffffl for computing align_mask
Date: Sun, 19 Jul 2015 08:27:24 -0700	[thread overview]
Message-ID: <20150719152724.GB3729@roeck-us.net> (raw)
In-Reply-To: <20150719121653.GA30645@oracle.com>

On Sun, Jul 19, 2015 at 02:20:14PM +0200, Sowmini Varadhan wrote:
> 
> Using a 64 bit constant generates "warning: integer constant is too
> large for 'long' type" on 32 bit platforms. Instead use ~0l to get
> the desired effect.
> 
> Detected by Andrew Morton who has confirmed that this patch
> fixes the warning on i386/gcc-4.4.3, i386/gcc-4.4.0 and arm/gcc-4.4.4.
> 
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
> ---
>  lib/iommu-common.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/iommu-common.c b/lib/iommu-common.c
> index df30632..fd1297d 100644
> --- a/lib/iommu-common.c
> +++ b/lib/iommu-common.c
> @@ -119,7 +119,7 @@ unsigned long iommu_tbl_range_alloc(struct device *dev,
>  	unsigned long align_mask = 0;
>  
>  	if (align_order > 0)
> -		align_mask = 0xffffffffffffffffl >> (64 - align_order);
> +		align_mask = ~0l >> (64 - align_order);
>  
Wonder if this just hides the real problem. Unless align_order
is very large, the resulting mask on 32 bit systems may be 0.
Is this really the idea ?

Guenter

  reply	other threads:[~2015-07-19 15:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-19 12:20 Sowmini Varadhan
2015-07-19 15:27 ` Guenter Roeck [this message]
2015-07-19 20:25   ` Rasmus Villemoes
2015-07-19 20:41     ` Sowmini Varadhan
2015-07-20  1:58     ` Guenter Roeck
2015-07-20 17:57       ` Rasmus Villemoes
2015-07-20 19:25         ` Sowmini Varadhan
2015-07-20 23:28         ` Andrew Morton
2015-07-21  0:26           ` Guenter Roeck
2015-07-20 14:44   ` Sowmini Varadhan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150719152724.GB3729@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sowmini.varadhan@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome