linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* include/drm/i915_drm.h:96: possible bad bitmask ?
@ 2016-08-08  9:31 David Binderman
  2016-08-08  9:40 ` [Intel-gfx] " Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: David Binderman @ 2016-08-08  9:31 UTC (permalink / raw)
  To: daniel.vetter, jani.nikula, David Airlie, dcb314, intel-gfx,
	dri-devel, Linux Kernel Mailing List

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.


Regards

David Binderman

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ?
  2016-08-08  9:31 include/drm/i915_drm.h:96: possible bad bitmask ? David Binderman
@ 2016-08-08  9:40 ` Daniel Vetter
  2016-08-09  2:59   ` Dave Airlie
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2016-08-08  9:40 UTC (permalink / raw)
  To: David Binderman
  Cc: daniel.vetter, jani.nikula, David Airlie, dcb314, intel-gfx,
	dri-devel, Linux Kernel Mailing List

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?
-Daniel

> 
> 
> Regards
> 
> David Binderman
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ?
  2016-08-08  9:40 ` [Intel-gfx] " Daniel Vetter
@ 2016-08-09  2:59   ` Dave Airlie
  2016-08-09 16:01     ` Dave Gordon
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2016-08-09  2:59 UTC (permalink / raw)
  To: David Binderman, Vetter, Daniel, Jani Nikula, David Airlie,
	dcb314, intel-gfx, dri-devel, Linux Kernel Mailing List

On 8 August 2016 at 19:40, Daniel Vetter <daniel@ffwll.ch> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ?
  2016-08-09  2:59   ` Dave Airlie
@ 2016-08-09 16:01     ` Dave Gordon
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Gordon @ 2016-08-09 16:01 UTC (permalink / raw)
  To: Dave Airlie, David Binderman, Vetter, Daniel, Jani Nikula,
	David Airlie, dcb314, intel-gfx, dri-devel,
	Linux Kernel Mailing List

On 09/08/16 03:59, Dave Airlie wrote:
> On 8 August 2016 at 19:40, Daniel Vetter <daniel@ffwll.ch> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-09 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08  9:31 include/drm/i915_drm.h:96: possible bad bitmask ? David Binderman
2016-08-08  9:40 ` [Intel-gfx] " Daniel Vetter
2016-08-09  2:59   ` Dave Airlie
2016-08-09 16:01     ` Dave Gordon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).