Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457658 > unrolled thread

include/drm/i915_drm.h:96: possible bad bitmask ?

Started byDavid Binderman <linuxdev.baldrick@gmail.com>
First post2016-08-08 11:40 +0200
Last post2016-08-09 18:10 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  include/drm/i915_drm.h:96: possible bad bitmask ? David Binderman <linuxdev.baldrick@gmail.com> - 2016-08-08 11:40 +0200
    Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ? Daniel Vetter <daniel@ffwll.ch> - 2016-08-08 11:50 +0200
      Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ? Dave Airlie <airlied@gmail.com> - 2016-08-09 05:00 +0200
        Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ? Dave Gordon <david.s.gordon@intel.com> - 2016-08-09 18:10 +0200

#1457658 — include/drm/i915_drm.h:96: possible bad bitmask ?

FromDavid Binderman <linuxdev.baldrick@gmail.com>
Date2016-08-08 11:40 +0200
Subjectinclude/drm/i915_drm.h:96: possible bad bitmask ?
Message-ID<s3Pcl-82a-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1457666 — Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ?

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-08-08 11:50 +0200
SubjectRe: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ?
Message-ID<s3Pm1-85D-13@gated-at.bofh.it>
In reply to#1457658
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

[toc] | [prev] | [next] | [standalone]


#1458376 — Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ?

FromDave Airlie <airlied@gmail.com>
Date2016-08-09 05:00 +0200
SubjectRe: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ?
Message-ID<s45qN-1AB-1@gated-at.bofh.it>
In reply to#1457666
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.

[toc] | [prev] | [next] | [standalone]


#1458883 — Re: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ?

FromDave Gordon <david.s.gordon@intel.com>
Date2016-08-09 18:10 +0200
SubjectRe: [Intel-gfx] include/drm/i915_drm.h:96: possible bad bitmask ?
Message-ID<s4hLj-1pO-21@gated-at.bofh.it>
In reply to#1458376
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web