Review Request 127968: kshareddatacache: Fix invalid use of & to avoid unaligned reads

Fabian Vogt fabian at ritter-vogt.de
Fri May 20 08:08:57 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127968/
-----------------------------------------------------------

(Updated May 20, 2016, 11:08 a.m.)


Status
------

This change has been marked as submitted.


Review request for KDE Frameworks, David Faure and Michael Pyne.


Changes
-------

Submitted with commit 2bd185e719a83143e140758b0fad6d4e1488bc24 by Luca Beltrame on behalf of Fabian Vogt to branch master.


Repository: kcoreaddons


Description
-------

That the & is wrong here is obvious:
align can never be 2 inside the if condition as ```(2 & bool)``` is always false,
yet the switch on align contains a case for 2.
Instead it drops into the while loop for an 4-byte aligned pointer.

This doesn't change the returned values on platforms where unaligned reads
are permitted, so I didn't bump the version.


Diffs
-----

  src/lib/caching/kshareddatacache.cpp 50bbf64 

Diff: https://git.reviewboard.kde.org/r/127968/diff/


Testing
-------

Ran make test, all passed.


Thanks,

Fabian Vogt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160520/442d847c/attachment.html>


More information about the Kde-frameworks-devel mailing list