From patchwork Wed Jul 27 03:11:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salah Triki X-Patchwork-Id: 9249207 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 F2FBC607D8 for ; Wed, 27 Jul 2016 03:12:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5301276AE for ; Wed, 27 Jul 2016 03:12:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D996C27BE5; Wed, 27 Jul 2016 03:12:40 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 CE1CC276AE for ; Wed, 27 Jul 2016 03:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750975AbcG0DMV (ORCPT ); Tue, 26 Jul 2016 23:12:21 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:32770 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750813AbcG0DMT (ORCPT ); Tue, 26 Jul 2016 23:12:19 -0400 Received: by mail-wm0-f66.google.com with SMTP id o80so4437037wme.0; Tue, 26 Jul 2016 20:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Ijk7gzPHqo8F7/JN483uWEIgvPnf01bwYprOMRepW7E=; b=qlh32kdsRvpOCDMUgC7gNLVwiXzHwcaB1dvRfpTntwVI5nLpkH/YZ0BPZKyjU4W4d3 TKgTPVMQkNC9oMUXaE4xGi26Pzu4xwuwSv5GTJmPpTgFs4OQTEToPHAuEJ8NvMuAl3TR nmZ+buHGrvPaUWMhW9Cd3pS92Vzb+G15wf3wRE7dRR6zQCBuz3c+mK+yzvlL8FgkjMNo OIiucfu4KrU5x/KtfvDvKmsVpEkzTDxoRym3rtAMxPq90ZpnylcJiQmgWc6lPKFbZD9K r05ZHqlz7A3wP9FLbkYP/Esw+7aCI2/cvs9ujZKNliYKVCykrANwk3JuO+NrPF42YARQ bQoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ijk7gzPHqo8F7/JN483uWEIgvPnf01bwYprOMRepW7E=; b=bM/ZZNN2GApq2Yu9A4Y0XWA8NBF4yf+fildm2TiTcsWc51987agIza6nAQzxbTszhb bXGI/zlStpfhtqMEoa49nrDiUArZI2mHHZMh4HX2XRxDKTtgPNJAKPoz6BucrIE6yRHC ol3d90zQ/RhnM2c3eA/qNUkGlg7J8XcSbY5lkI4c1AZPn1WAxBjiwxIhik1J8U4MLM+s g+2XF/aU+IG65ibpQ8IGMk0u06M8dhJrVPUpmVvP9p02QjWbTD3EYwjJ8aYf3sKJtb/1 esYL5rGF/gtsjmSkkQuDa7GEz/0ojsS/Ml52BCFKKJQ36hQ/5dhRRJIyGvEpqAXm9+3I ae0A== X-Gm-Message-State: AEkoouvwdlEX7Pem9QyZF9OLn9QCBiP/2x2yvC1FRi27GWP7aN31zuSzR3LvvZMF8SNqDg== X-Received: by 10.28.48.71 with SMTP id w68mr28362352wmw.4.1469589138005; Tue, 26 Jul 2016 20:12:18 -0700 (PDT) Received: from localhost.localdomain ([41.224.169.131]) by smtp.gmail.com with ESMTPSA id e65sm4696967wmg.3.2016.07.26.20.12.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Jul 2016 20:12:17 -0700 (PDT) From: Salah Triki To: akpm@linux-foundation.org, viro@ZenIV.linux.org.uk Cc: luisbg@osg.samsung.com, mhocko@suse.com, vdavydov@virtuozzo.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, salah.triki@gmail.com Subject: [RESEND PATCH 1/4] fs: befs: Remove redundant validation from befs_find_brun_direct Date: Wed, 27 Jul 2016 04:11:52 +0100 Message-Id: <9859a616787673d2f36ce21d4aa0220637c55001.1469588473.git.salah.triki@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The only caller of befs_find_brun_direct is befs_fblock2brun, which already validates that the block is within the range of direct blocks. So remove the duplicate validation. Signed-off-by: Salah Triki Acked-by: Luis de Bethencourt --- fs/befs/datastream.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index 26cc417..e224b9a 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c @@ -249,17 +249,9 @@ befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data, int i; const befs_block_run *array = data->direct; befs_blocknr_t sum; - befs_blocknr_t max_block = - data->max_direct_range >> BEFS_SB(sb)->block_shift; befs_debug(sb, "---> %s, find %lu", __func__, (unsigned long)blockno); - if (blockno > max_block) { - befs_error(sb, "%s passed block outside of direct region", - __func__); - return BEFS_ERR; - } - for (i = 0, sum = 0; i < BEFS_NUM_DIRECT_BLOCKS; sum += array[i].len, i++) { if (blockno >= sum && blockno < sum + (array[i].len)) {