Skip to content

Wayland/DRM: Fix an uninitialized variable and undefined behavior in Plasma/5.27

Nathan Mills requested to merge quipyowert/kwin:cppcheck-fixes into master

This MR fixes an uninitialized variable in Wayland and an undefined behavior in DRM, both found with Cppcheck. The undefined behavior is due to shifting a 32-bit value by 63 bits. I added an extra l to the suffix on that value, which makes it a long long (64-bits), so it should be fixed now. I fixed the uninitialized variable by initializing in the body of the constructor; should I put that in the initializer list instead?

I would've added more commits to this MR, but when I installed WSL2 lately, my Linux virtual machine would not start anymore. I had a third commit in this MR, but I removed it because it was just code churn instead of actually improving the code.

I built KWin from source using kdesrc-build kwin with this .kdesrc-buildrc config in a Linux virtual machine in VirtualBox. Since Leap packages were too old, I had to compile for Qt 5 instead of 6.

Versions:

  • KWin version: branch Plasma/5.27
  • KDE Frameworks version: don't remember, maybe the latest one that works on Qt 5?
  • Qt version: 5.15 (?) (not sure, my virtual machine won't start)
  • Cppcheck version: 2.10
  • VirtualBox guest: openSUSE Leap 15.5 with 5.14.21 kernel
  • VirtualBox version: 6.1.40
Edited by Nathan Mills

Merge request reports