Commit 7551a074 authored by Wu Bo's avatar Wu Bo Committed by Herbert Xu
Browse files

crypto: af_alg - use DIV_ROUND_UP helper macro for calculations



Replace open coded divisor calculations with the DIV_ROUND_UP kernel
macro for better readability.

Signed-off-by: default avatarWu Bo <wubo40@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e9009fb2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len)
	if (n < 0)
		return n;

	npages = (off + n + PAGE_SIZE - 1) >> PAGE_SHIFT;
	npages = DIV_ROUND_UP(off + n, PAGE_SIZE);
	if (WARN_ON(npages == 0))
		return -EINVAL;
	/* Add one extra for linking */