Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4171545pxj; Tue, 25 May 2021 01:53:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuULkVKksrjUIy4BVz1MTZZ79nPa0Hy12W0KQv3fCAYlbUz+bGygy2kMQWcmo0Y8IQsNZu X-Received: by 2002:a05:6402:781:: with SMTP id d1mr31374480edy.32.1621932828665; Tue, 25 May 2021 01:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621932828; cv=none; d=google.com; s=arc-20160816; b=MYmSJ6u4ujaBmCcgLSSED9jo1D7tHwGLm4RNkdVjyDC450LpKI8jjYrdAu0AGyOSLb 4Q4m5APOMAw1kfnljJDiLgo1w9MXKTi/J5YcJf4QPn99TMbNaZel6ubGyq2GJuJDXke2 Fn8+9ccn96Y8zoN6s6IVFqa2M4IXQ9Es91HSQIOLIDJ/Quc/sbL6QGxn036pjFKdDWiZ 7stGP7eAt+Jdz18jCXcVOx83NtKROFf8GdNMb59Odtxco9hrrXwM+yD/ts0uTgZ9++he PXD4ZcOXirJ/rY1E56O4PeR+gvIbb7nMCGUQtau/aElVwHkIt/y1AF1mI+HjTeKyCL8R 7ZHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:user-agent:in-reply-to:references:subject:cc:to:from :message-id:date; bh=N43OUg62f750c2DA/+BEQqJSOUtmwCavRi1r0rYd9LE=; b=LKgmpIOHJxuE0JcFwUYz5sY66aaezLM5/oAajok/Y4mFkRUX0y6NhB9d8M8bHAreEx bSxufAAu7Qf6KiVB1yfeJbLB9MULOK0FOG1l/dmChyx07W/7OFihmJyP3miSBMnPNHEo du33oZff7HiqmtcdAJCCtonX5QiphBsJMLNP4LkZPSUPoKttJx/9QXs+d+CFmLck69Vx sZTVviPQe0M2Throi5Vy9sQpT8jHnTEiAG5Ns8OTPxazp8vjxofPyLIBNFSjuaHqlV5L /Z3504A9f3EAWlgWn8HrT1E455ovDbVWKkDI70Wrag6tYgzV9vGQzzx/63TuuEhaCQ3V bLeg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si15951043edq.129.2021.05.25.01.53.22; Tue, 25 May 2021 01:53:48 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230385AbhEYIfc convert rfc822-to-8bit (ORCPT + 99 others); Tue, 25 May 2021 04:35:32 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:55330 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231328AbhEYIfY (ORCPT ); Tue, 25 May 2021 04:35:24 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4Fq6mH24T3zBBxl; Tue, 25 May 2021 10:33:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8CJvT3fW2Ivs; Tue, 25 May 2021 10:33:19 +0200 (CEST) Received: from vm-hermes.si.c-s.fr (vm-hermes.si.c-s.fr [192.168.25.253]) by pegase1.c-s.fr (Postfix) with ESMTP id 4Fq6mH1Br4zBBm1; Tue, 25 May 2021 10:33:19 +0200 (CEST) Received: by vm-hermes.si.c-s.fr (Postfix, from userid 33) id 68EE0BBC; Tue, 25 May 2021 10:37:44 +0200 (CEST) Received: from 37.173.125.11 ([37.173.125.11]) by messagerie.c-s.fr (Horde Framework) with HTTP; Tue, 25 May 2021 10:37:44 +0200 Date: Tue, 25 May 2021 10:37:44 +0200 Message-ID: <20210525103744.Horde.nmFFeC3J2_-Qdu7udOYa8g1@messagerie.c-s.fr> From: Christophe Leroy To: Wu Bo Cc: linfeilong@huawei.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-fsdevel@vger.kernel.org, davem@davemloft.net, herbert@gondor.apana.org.au, viro@zeniv.linux.org.uk Subject: Re: [PATCH 1/2] crypto: af_alg - use DIV_ROUND_UP helper macro for calculations References: <1621930520-515336-1-git-send-email-wubo40@huawei.com> <1621930520-515336-2-git-send-email-wubo40@huawei.com> In-Reply-To: <1621930520-515336-2-git-send-email-wubo40@huawei.com> User-Agent: Internet Messaging Program (IMP) H5 (6.2.3) Content-Type: text/plain; charset=UTF-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Wu Bo a écrit : > 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); You should use PFN_UP() > if (WARN_ON(npages == 0)) > return -EINVAL; > /* Add one extra for linking */ > -- > 1.8.3.1