mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-05 08:00:30 +00:00
Fix a bitwise logic error in posix_memalign().
Reported by: glebius
This commit is contained in:
parent
7a62fb4692
commit
352219015d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154263
|
@ -1161,11 +1161,11 @@ posix_memalign(void **memptr, size_t alignment, size_t size)
|
|||
return (EINVAL);
|
||||
|
||||
/*
|
||||
* (size & alignment) is enough to assure the requested alignment, since
|
||||
* (size | alignment) is enough to assure the requested alignment, since
|
||||
* the allocator always allocates power-of-two blocks.
|
||||
*/
|
||||
err = errno; /* Protect errno against changes in pubrealloc(). */
|
||||
result = pubrealloc(NULL, (size & alignment), " in posix_memalign()");
|
||||
result = pubrealloc(NULL, (size | alignment), " in posix_memalign()");
|
||||
errno = err;
|
||||
|
||||
if (result == NULL)
|
||||
|
|
Loading…
Reference in a new issue