From patchwork Wed May 17 12:10:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9730999 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D60B560363 for ; Wed, 17 May 2017 12:10:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C89FA2875B for ; Wed, 17 May 2017 12:10:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD86A28772; Wed, 17 May 2017 12:10:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56CA62863B for ; Wed, 17 May 2017 12:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752165AbdEQMK5 (ORCPT ); Wed, 17 May 2017 08:10:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:34180 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752796AbdEQMK4 (ORCPT ); Wed, 17 May 2017 08:10:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D834BABBD; Wed, 17 May 2017 12:10:54 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 4155C1E34E9; Wed, 17 May 2017 14:10:53 +0200 (CEST) From: Jan Kara To: "Darrick J . Wong" Cc: , Brian Foster , Jan Kara Subject: [PATCH 2/3] xfs: Fix off-by-in in loop termination in xfs_find_get_desired_pgoff() Date: Wed, 17 May 2017 14:10:45 +0200 Message-Id: <20170517121046.2632-3-jack@suse.cz> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170517121046.2632-1-jack@suse.cz> References: <20170517121046.2632-1-jack@suse.cz> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is an off-by-one error in loop termination conditions in xfs_find_get_desired_pgoff(). It doesn't have any visible effects but still it is good to fix it. Signed-off-by: Jan Kara --- fs/xfs/xfs_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index f371812e20c6..8acb8ab79267 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1097,7 +1097,7 @@ xfs_find_get_desired_pgoff( goto out; } /* Searching done if the page index is out of range. */ - if (page->index > end) + if (page->index >= end) goto out; lock_page(page); @@ -1153,7 +1153,7 @@ xfs_find_get_desired_pgoff( index = pvec.pages[i - 1]->index + 1; pagevec_release(&pvec); - } while (index <= end); + } while (index < end); out: pagevec_release(&pvec);