X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Futils_benchmark.c;h=f39238284fb3e1b8a1742a9968266ef9d470e512;hb=80d21c039e784e6b693a5e78069816ca6f9b7939;hp=4ee0c03331bd52191d2b92a7a81e065ffd6db7be;hpb=549ab6435806fe48206f9051f2acd13829030c27;p=platform%2Fupstream%2Fcryptsetup.git diff --git a/lib/utils_benchmark.c b/lib/utils_benchmark.c index 4ee0c03..f392382 100644 --- a/lib/utils_benchmark.c +++ b/lib/utils_benchmark.c @@ -128,9 +128,14 @@ static int cipher_perf(struct cipher_perf *cp, { long ms_enc, ms_dec, ms; int repeat_enc, repeat_dec; + size_t alignment; void *buf = NULL; - if (posix_memalign(&buf, crypt_getpagesize(), cp->buffer_size)) + alignment = crypt_getpagesize(); + if (alignment < 0) + return -EINVAL; + + if (posix_memalign(&buf, alignment, cp->buffer_size)) return -ENOMEM; ms_enc = 0;