Dan Carpenter
2018-Jun-26 08:49 UTC
[Nouveau] [bug report] drm/nouveau/disp/nv50-: add channel interfaces to control error interrupts
Hello Ben Skeggs, The patch a9c44a88ca2f: "drm/nouveau/disp/nv50-: add channel interfaces to control error interrupts" from May 8, 2018, leads to the following static checker warning: drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c:169 nv50_disp_chan_intr() warn: should '65537 << chan->chid.user' be a 64 bit type? drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c 165 void 166 nv50_disp_chan_intr(struct nv50_disp_chan *chan, bool en) 167 { 168 struct nvkm_device *device = chan->disp->base.engine.subdev.device; 169 const u64 mask = 0x00010001 << chan->chid.user; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Can this shift wrap? 170 const u64 data = en ? 0x00010000 : 0x00000000; 171 nvkm_mask(device, 0x610028, mask, data); 172 } regards, dan carpenter
Ilia Mirkin
2018-Jun-26 11:54 UTC
[Nouveau] [bug report] drm/nouveau/disp/nv50-: add channel interfaces to control error interrupts
On Tue, Jun 26, 2018, 04:49 Dan Carpenter <dan.carpenter at oracle.com> wrote:> Hello Ben Skeggs, > > The patch a9c44a88ca2f: "drm/nouveau/disp/nv50-: add channel > interfaces to control error interrupts" from May 8, 2018, leads to > the following static checker warning: > > drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c:169 > nv50_disp_chan_intr() > warn: should '65537 << chan->chid.user' be a 64 bit type? > > drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c > 165 void > 166 nv50_disp_chan_intr(struct nv50_disp_chan *chan, bool en) > 167 { > 168 struct nvkm_device *device > chan->disp->base.engine.subdev.device; > 169 const u64 mask = 0x00010001 << chan->chid.user; > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Can this shift wrap? >This should be a u32, not u64. Same for mask below. The value of user is <16.> 170 const u64 data = en ? 0x00010000 : 0x00000000; >Ben, is this a bug? Shouldn't this also be shifted? 171 nvkm_mask(device, 0x610028, mask, data); 172 }> > regards, > dan carpenter > _______________________________________________ > Nouveau mailing list > Nouveau at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau >-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20180626/2198a351/attachment.html>
Apparently Analagous Threads
- [PATCH][next] drm/nouveau/disp: avoid potential overflow on shift of int value
- [bug report] drm/nouveau/disp/nv50-: add channel interfaces to control error interrupts
- [PATCH] nv50_disp_chan_mthd: ensure mthd is not NULL
- [PATCH 0/2] drm/nouveau: Fix GM107 disp init failures on ThinkPad P50
- [PATCH] nv50_disp_chan_mthd: ensure mthd is not NULL