Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757028AbbGTR5Y (ORCPT ); Mon, 20 Jul 2015 13:57:24 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:33023 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755775AbbGTR5W (ORCPT ); Mon, 20 Jul 2015 13:57:22 -0400 From: Rasmus Villemoes To: Guenter Roeck Cc: Sowmini Varadhan , 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 Organization: D03 References: <20150719121653.GA30645@oracle.com> <20150719152724.GB3729@roeck-us.net> <874mkzevz4.fsf@rasmusvillemoes.dk> <55AC55AD.6070608@roeck-us.net> X-Hashcash: 1:20:150720:akpm@linux-foundation.org::MP5QXNAqm0RFnCbw:0000000000000000000000000000000000000vUC X-Hashcash: 1:20:150720:linux@roeck-us.net::xDDbaxlD1LjewA+B:00000000000000000000000000000000000000000001X+i X-Hashcash: 1:20:150720:linux-kernel@vger.kernel.org::mCZk53RIP8sWXNk3:0000000000000000000000000000000001X0c X-Hashcash: 1:20:150720:sowmini.varadhan@oracle.com::Bx2nIkl80g1Damam:00000000000000000000000000000000002MVE X-Hashcash: 1:20:150720:davem@davemloft.net::lqeXdAQJp5KUdGej:0000000000000000000000000000000000000000003jFW X-Hashcash: 1:20:150720:benh@kernel.crashing.org::cPD2pywHoaNWxJJd:00000000000000000000000000000000000005hTO Date: Mon, 20 Jul 2015 19:57:18 +0200 In-Reply-To: <55AC55AD.6070608@roeck-us.net> (Guenter Roeck's message of "Sun, 19 Jul 2015 18:58:05 -0700") Message-ID: <87oaj6ogox.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 779 Lines: 20 On Mon, Jul 20 2015, Guenter Roeck wrote: > So either case ~0l appears to be wrong; it should be ~0ul. Yes, right-shifting -1 of any type is probably always wrong, as it will always give -1 again. Probably one should add a smatch/sparse warning for that. > I don't know if ~0ull makes a difference for some architectures. I highly doubt it. The result is truncated to unsigned long anyway. Assuming align_order always has a value between 0 and BITS_PER_LONG, GENMASK should be exactly what is wanted. Rasmus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/