Message ID | 20230314211445.1363828-1-zack@kde.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/vmwgfx: Fix src/dst_pitch confusion | expand |
On Tue, Mar 14, 2023 at 05:14:45PM -0400, Zack Rusin wrote: > From: Zack Rusin <zackr@vmware.com> > > The src/dst_pitch got mixed up during the rework of the function, make > sure the offset's refer to the correct one. > > Spotted by clang: > Clang warns (or errors with CONFIG_WERROR): > > drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:509:29: error: variable 'dst_pitch' is uninitialized when used here [-Werror,-Wuninitialized] > src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; > ^~~~~~~~~ > drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:492:26: note: initialize the variable 'dst_pitch' to silence this warning > s32 src_pitch, dst_pitch; > ^ > = 0 > 1 error generated. > > Signed-off-by: Zack Rusin <zackr@vmware.com> > Link: https://github.com/ClangBuiltLinux/linux/issues/1811 > Reported-by: Nathan Chancellor <nathan@kernel.org> > Reported-by: Dave Airlie <airlied@gmail.com> > Fixes: 39985eea5a6d ("drm/vmwgfx: Abstract placement selection") Reviewed-by: Nathan Chancellor <nathan@kernel.org> Thanks for the quick response and patch! > --- > drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c > index d79a6eccfaa4..ba0c0e12cfe9 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c > @@ -506,11 +506,11 @@ static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty) > /* Assume we are blitting from Guest (bo) to Host (display_srf) */ > src_pitch = stdu->display_srf->metadata.base_size.width * stdu->cpp; > src_bo = &stdu->display_srf->res.guest_memory_bo->tbo; > - src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; > + src_offset = ddirty->top * src_pitch + ddirty->left * stdu->cpp; > > dst_pitch = ddirty->pitch; > dst_bo = &ddirty->buf->tbo; > - dst_offset = ddirty->fb_top * src_pitch + ddirty->fb_left * stdu->cpp; > + dst_offset = ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp; > > (void) vmw_bo_cpu_blit(dst_bo, dst_offset, dst_pitch, > src_bo, src_offset, src_pitch, > -- > 2.38.1 >
From: Martin Krastev <krastevm@vmware.com> We reviewers botched that one. Reviewed-by: Martin Krastev <krastevm@vmware.com> Regards, Martin On 14.03.23 г. 23:14 ч., Zack Rusin wrote: > From: Zack Rusin <zackr@vmware.com> > > The src/dst_pitch got mixed up during the rework of the function, make > sure the offset's refer to the correct one. > > Spotted by clang: > Clang warns (or errors with CONFIG_WERROR): > > drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:509:29: error: variable 'dst_pitch' is uninitialized when used here [-Werror,-Wuninitialized] > src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; > ^~~~~~~~~ > drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:492:26: note: initialize the variable 'dst_pitch' to silence this warning > s32 src_pitch, dst_pitch; > ^ > = 0 > 1 error generated. > > Signed-off-by: Zack Rusin <zackr@vmware.com> > Link: https://github.com/ClangBuiltLinux/linux/issues/1811 > Reported-by: Nathan Chancellor <nathan@kernel.org> > Reported-by: Dave Airlie <airlied@gmail.com> > Fixes: 39985eea5a6d ("drm/vmwgfx: Abstract placement selection") > --- > drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c > index d79a6eccfaa4..ba0c0e12cfe9 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c > @@ -506,11 +506,11 @@ static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty) > /* Assume we are blitting from Guest (bo) to Host (display_srf) */ > src_pitch = stdu->display_srf->metadata.base_size.width * stdu->cpp; > src_bo = &stdu->display_srf->res.guest_memory_bo->tbo; > - src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; > + src_offset = ddirty->top * src_pitch + ddirty->left * stdu->cpp; > > dst_pitch = ddirty->pitch; > dst_bo = &ddirty->buf->tbo; > - dst_offset = ddirty->fb_top * src_pitch + ddirty->fb_left * stdu->cpp; > + dst_offset = ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp; > > (void) vmw_bo_cpu_blit(dst_bo, dst_offset, dst_pitch, > src_bo, src_offset, src_pitch,
On Thu, 16 Mar 2023 at 01:25, Martin Krastev (VMware) <martinkrastev768@gmail.com> wrote: > > From: Martin Krastev <krastevm@vmware.com> > > We reviewers botched that one. > > Reviewed-by: Martin Krastev <krastevm@vmware.com> Can someone land this into drm-misc-next please so I can start building with clang again? Dave.
On Tue, 2023-03-21 at 08:46 +1000, Dave Airlie wrote: > !! External Email > > On Thu, 16 Mar 2023 at 01:25, Martin Krastev (VMware) > <martinkrastev768@gmail.com> wrote: > > > > From: Martin Krastev <krastevm@vmware.com> > > > > We reviewers botched that one. > > > > Reviewed-by: Martin Krastev <krastevm@vmware.com> > > Can someone land this into drm-misc-next please so I can start > building with clang again? It landed there 5 days ago: https://cgit.freedesktop.org/drm/drm-misc/commit/?id=328839ff93709a517e89ba1de1132c5d138e5dcb z
On Tue, 21 Mar 2023 at 09:42, Zack Rusin <zackr@vmware.com> wrote: > > On Tue, 2023-03-21 at 08:46 +1000, Dave Airlie wrote: > > !! External Email > > > > On Thu, 16 Mar 2023 at 01:25, Martin Krastev (VMware) > > <martinkrastev768@gmail.com> wrote: > > > > > > From: Martin Krastev <krastevm@vmware.com> > > > > > > We reviewers botched that one. > > > > > > Reviewed-by: Martin Krastev <krastevm@vmware.com> > > > > Can someone land this into drm-misc-next please so I can start > > building with clang again? > > It landed there 5 days ago: > https://cgit.freedesktop.org/drm/drm-misc/commit/?id=328839ff93709a517e89ba1de1132c5d138e5dcb Oops, I just pulled a tree without it so made bad assumption, sorry for noise! Dave.
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index d79a6eccfaa4..ba0c0e12cfe9 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@ -506,11 +506,11 @@ static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty) /* Assume we are blitting from Guest (bo) to Host (display_srf) */ src_pitch = stdu->display_srf->metadata.base_size.width * stdu->cpp; src_bo = &stdu->display_srf->res.guest_memory_bo->tbo; - src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; + src_offset = ddirty->top * src_pitch + ddirty->left * stdu->cpp; dst_pitch = ddirty->pitch; dst_bo = &ddirty->buf->tbo; - dst_offset = ddirty->fb_top * src_pitch + ddirty->fb_left * stdu->cpp; + dst_offset = ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp; (void) vmw_bo_cpu_blit(dst_bo, dst_offset, dst_pitch, src_bo, src_offset, src_pitch,