From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752731AbcHIQBY (ORCPT ); Tue, 9 Aug 2016 12:01:24 -0400 Received: from mga02.intel.com ([134.134.136.20]:22831 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752103AbcHIQBX (ORCPT ); Tue, 9 Aug 2016 12:01:23 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,495,1464678000"; d="scan'208";a="1011270349" Subject: Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ? To: Dave Airlie , David Binderman , "Vetter, Daniel" , Jani Nikula , David Airlie , dcb314@hotmail.com, "intel-gfx@lists.freedesktop.org" , dri-devel , Linux Kernel Mailing List References: <20160808094027.GA6232@phenom.ffwll.local> From: Dave Gordon Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Message-ID: Date: Tue, 9 Aug 2016 17:01:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/08/16 03:59, Dave Airlie wrote: > On 8 August 2016 at 19:40, Daniel Vetter wrote: >> On Mon, Aug 08, 2016 at 10:31:32AM +0100, David Binderman wrote: >>> Hello there, >>> >>> Recent versions of gcc say this: >>> >>> include/drm/i915_drm.h:96:34: warning: result of β€˜65535 << 20’ >>> requires 37 bits to represent, but β€˜int’ only has 32 bits >>> [-Wshift-overflow=] >>> >>> Source code is >>> >>> #define INTEL_BSM_MASK (0xFFFF << 20) >>> >>> Maybe something like >>> >>> #define INTEL_BSM_MASK (0xFFFFUL<< 20) >>> >>> might be better. >> >> Yup. Care to bake this into a patch (with s-o-b and everything per >> Documentation/SubmittingPatches) so I can apply it? > > Why would you want to apply a clearly incorrect patch :-) > > INTEL_BSM_MASK is used in one place, on a 32-bit number > > I'm not sure what it needs to be, but a 64-bit number it doesn't. > > Dave. I found two uses, but in both cases it's masking a value read from a 32-bit PCI register, so it can just be (-(1 << 20)). .Dave.