Both src and dst should be alignment checked separately

The following pattern passes the current check:

src  - 1010
dst  - 0101
mask - 1111
This commit is contained in:
Arun Prakash Jana 2018-03-03 01:08:15 +05:30
parent 815d8fb21c
commit 10e84a28ed
No known key found for this signature in database
GPG key ID: A75979F35C080412

2
nnn.c
View file

@ -488,7 +488,7 @@ xstrlcpy(char *dest, const char *src, size_t n)
* To enable -O3 ensure src and dest are 16-byte aligned * To enable -O3 ensure src and dest are 16-byte aligned
* More info: http://www.felixcloutier.com/x86/MOVDQA.html * More info: http://www.felixcloutier.com/x86/MOVDQA.html
*/ */
if ((n >= lsize) && !((ulong)src & (ulong)dest & _ALIGNMENT_MASK)) { if ((n >= lsize) && (((ulong)src & _ALIGNMENT_MASK) == 0 && ((ulong)dest & _ALIGNMENT_MASK) == 0)) {
s = (ulong *)src; s = (ulong *)src;
d = (ulong *)dest; d = (ulong *)dest;
blocks = n >> _WSHIFT; blocks = n >> _WSHIFT;