Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp360887pxb; Wed, 29 Sep 2021 00:32:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwJxKk/ylK3YRSatnN7NSlARPIxtXTZV3gxkb0mguFsvfjsxU+ZnsArIiyTN7ZqXagL4r0 X-Received: by 2002:aa7:d9d3:: with SMTP id v19mr13201537eds.131.1632900749235; Wed, 29 Sep 2021 00:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632900749; cv=none; d=google.com; s=arc-20160816; b=mJ+Y6VnuZvz4VmPPY8xAC/rWE2BzDlyS64Eqsw+wK93VgJ3IcRC0jBJqi+80KZhMcI 74rljHZFLDqcivTael5yRKPTt1MDPtFLaYu2k1EynNGRzcXnQcypHIg5TKkorj4d43w0 Lxaz32qn9/AsNKeJ3hK4LvUQyAkxuHjT4gQLoK04/h45x9Ghod0DN4MPabMhAV4nUOWa BZgP7kYeYY7zCQTEbBCC2ZpL+wBbZGzUu1aJhiw6csvGuccZLDHPt37LAOaBnetW1shP Dne5hJ/5/fgZkyhUoEn0BqT4ua+IinBBASGPV3Ub5AZ7d8fA14jD0U5dmnY2fDejeEzQ OomQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=laKaRvU+7c+7kBp6ISz/eSwd+h9NqbBpZ4SZdRjuG78=; b=HXKfjbVg7ulANYyWWh1TXcF+9i7OPdajSGd/Uk44vY2/B7Vdu+96m3OoF9Cl0iUzZG tvBz4pLBdsmoGVGxVXkQmYW3m31qujcragXddPakAU4DCcAMZ2z0PtaoA+ma8ZamYO9E NfdOQnX2xik+AuJ+J5FjIbKnMmB5+2lG7B7Mi1aQD0t6mdNm45uzJclZ1yL9kYCYVrF5 3BnFK9oh6e/PWK0tmVe69lc8UxnaypaRBEL+BHxa4/rKQ7MgURVzdsz3aIFMnsDlsTYY /y1Q2T+418LxmZ9KlcRW+1nVM9FoQxdYt2A/WVjBWdPFvsRZh0ecsImqEdHhbTZMB3Iy WaUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si2603240edv.5.2021.09.29.00.31.45; Wed, 29 Sep 2021 00:32:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243446AbhI2Hai (ORCPT + 99 others); Wed, 29 Sep 2021 03:30:38 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:55956 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243109AbhI2Hah (ORCPT ); Wed, 29 Sep 2021 03:30:37 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R401e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0Uq.dtWR_1632900533; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0Uq.dtWR_1632900533) by smtp.aliyun-inc.com(127.0.0.1); Wed, 29 Sep 2021 15:28:55 +0800 From: Yang Li To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li Subject: [PATCH -next] KVM: use vma_pages() helper Date: Wed, 29 Sep 2021 15:28:46 +0800 Message-Id: <1632900526-119643-1-git-send-email-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use vma_pages function on vma object instead of explicit computation. Fix the following coccicheck warning: ./virt/kvm/kvm_main.c:3526:29-35: WARNING: Consider using vma_pages helper on vma Reported-by: Abaci Robot Signed-off-by: Yang Li --- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 7851f3a..8f0e9ea 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3523,7 +3523,7 @@ static vm_fault_t kvm_vcpu_fault(struct vm_fault *vmf) static int kvm_vcpu_mmap(struct file *file, struct vm_area_struct *vma) { struct kvm_vcpu *vcpu = file->private_data; - unsigned long pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + unsigned long pages = vma_pages(vma); if ((kvm_page_in_dirty_ring(vcpu->kvm, vma->vm_pgoff) || kvm_page_in_dirty_ring(vcpu->kvm, vma->vm_pgoff + pages - 1)) && -- 1.8.3.1