Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4161809pxj; Tue, 25 May 2021 01:37:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXqpNEKNCUnfeMf4WGDmZJuNpVWB7+8q9+84nGf7JquEWAZdxQGnPjy+TEkHSpZxsWRKzD X-Received: by 2002:a05:6402:30ac:: with SMTP id df12mr30422356edb.117.1621931835057; Tue, 25 May 2021 01:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621931835; cv=none; d=google.com; s=arc-20160816; b=H465NK7AR1REF45nhYMu8TIuzhpNWmhuTldI01jATN4TvkyDZ7ZxDbr3VHtmgNL4n1 5/H6yhOTNv10Su13gX4+kYLFmaSpQl0wfJ1zDYjvFEd1ihOcqJ9IyZpkuthhFd9OOVrs K7o4U/UcVOnrkw8V0B23turciGAo4avQkyOI5tn8xRybX5d7rpi+80vPp3Aou3Lm48pK 89HcIGeVBECTDexMHOUmdXv+nj7+v0dViePQ8yGNZ2ZCDHrkYr+QFRqS/yJEi3T2odpH qKPYrom5WPVGBjK4Qw7TIotKivcgtl5jAfnOj9sfh0Yed7Z3FRDvV9kX07LL/CUinS0C t69g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Yq+0+4fB8R509F860m6XtJ0Pwstzy7g+k8trBEJTVwQ=; b=XFNiQQnYFNLXMyZTB8Sr8SaSV3w7NQF56/J9eUun1yblxeaaN5ep98zZzJc6lXHOft NvTpHrglfBXfrRFQNj50g/RYYjn08CxxFeYHnybAiWnvkHkVuNkAdpo1hnSN9glJDSEF P2I2icOR/CWzFQ7aUkzMoeGOO28P3TMKxNAtwzbkMCz5RUoPJt5AuvHAaPImpZX1r34X luR0volCwYpXUOaH8Wdq4FOHoeugIdxtShTjwquu2hCtROyi7UcfSIFbdXEoBOQ3aZKl 1qkeZcL62o7pA+NpOAZK+YnNyV8aQzOt4OkkbDIqcLzK0Y1XsA7fuKRwwdzsmDC9+GrN N1Jg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si13934657edu.487.2021.05.25.01.36.41; Tue, 25 May 2021 01:37:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232144AbhEYIJn (ORCPT + 99 others); Tue, 25 May 2021 04:09:43 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5548 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232023AbhEYIJP (ORCPT ); Tue, 25 May 2021 04:09:15 -0400 Received: from dggems701-chm.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Fq5kl32NqzwTPD; Tue, 25 May 2021 15:46:55 +0800 (CST) Received: from dggpeml500019.china.huawei.com (7.185.36.137) by dggems701-chm.china.huawei.com (10.3.19.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 15:49:41 +0800 Received: from huawei.com (10.175.124.27) by dggpeml500019.china.huawei.com (7.185.36.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 15:49:40 +0800 From: Wu Bo To: , , , , , CC: , Subject: [PATCH 1/2] crypto: af_alg - use DIV_ROUND_UP helper macro for calculations Date: Tue, 25 May 2021 16:15:19 +0800 Message-ID: <1621930520-515336-2-git-send-email-wubo40@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1621930520-515336-1-git-send-email-wubo40@huawei.com> References: <1621930520-515336-1-git-send-email-wubo40@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500019.china.huawei.com (7.185.36.137) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Wu Bo Replace open coded divisor calculations with the DIV_ROUND_UP kernel macro for better readability. Signed-off-by: Wu Bo --- crypto/af_alg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 18cc82d..8bd288d 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -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 */ -- 1.8.3.1