From patchwork Mon Aug 20 12:59:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10570345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 02A42921 for ; Mon, 20 Aug 2018 13:00:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2A1B2936C for ; Mon, 20 Aug 2018 13:00:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D40A32936E; Mon, 20 Aug 2018 13:00:03 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 790C42936C for ; Mon, 20 Aug 2018 13:00:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726750AbeHTQPf (ORCPT ); Mon, 20 Aug 2018 12:15:35 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46221 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbeHTQPf (ORCPT ); Mon, 20 Aug 2018 12:15:35 -0400 Received: by mail-lj1-f193.google.com with SMTP id 203-v6so11477564ljj.13 for ; Mon, 20 Aug 2018 06:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KFEGRNXG6jGhkWzKu1wMnVtS4eIhncZB52VPNE7hPHg=; b=tf/jAatwx0m5FsSFqhR25+PUkX2t3PP4xtCcm38GRHmos+trPhjTyVkToDIPVjzYZF inDYJK7JkpzMXQPVLKrhfzCTRSIdXAHykcXG/JGA7l8d7df2exDdlU8C55lmZvCZBC5w fAnQ5/w4CHNMZez7wHIMi/F4EwpsUZDNNV3fIZSbOd/bZDh3spu6AQUb4zke4DUtEoMD +jDVUZmxAkcpXlHJVlMM2yLpyYxgm4YbL51d5WhQo8OmJ14kj0nsEjqmfGqFQRQloyea eFBcE3eDDawoJY1Sf2+lWAv/ChXsRHYllbQg1PgM2aDKPsZsQGJkipSSwOJgIeP1dhU7 pDxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KFEGRNXG6jGhkWzKu1wMnVtS4eIhncZB52VPNE7hPHg=; b=PEOte5rFLiLrjFaTB6TPQm/K9vBCDrn4Hk5ZizO/rrZz4BZiKWv46jrrGjn4CdQkqt oX1jafzuL08pjKLV0QDjLDnPHwdkwHfeW+zMryHbMR8PBLLWDecSEGz9zcBLC9bFzZjx b8MSPMP7fztOFGJAdruLjAkbWXCNFpxU1g1MB1OJ84e0E+DzIH/fnMrSCQnWJqIhFPfN 9PHBFG9gdvwx7EkCd6W5zPsnBTf/iKiTLhcXFPp0wVgz0mwSx8pTMQgAfLKIePmEs+uM +sZ/62Eknm8ZkW/+SkIeEuHQx+/SbtVZEqZHz6FKAAlm8c08DWCFkzZ3bgpIyDrbyEm7 ueaQ== X-Gm-Message-State: AOUpUlEaooCqyfOaA9bPhNhETy7ta+QiGpiFazAyFWk3WTLYwaTRP3ON k2jIv8hQJF9A7RCEaGCq1DEFkQ== X-Google-Smtp-Source: AA+uWPyVjtqly7AyBK4P3cnDfGPpSxlNgF/OdxWymXe+vOr5Bh2pTMm2OTP88+o+ustfF6dJi3Kuqw== X-Received: by 2002:a2e:9941:: with SMTP id r1-v6mr30054946ljj.53.1534770001004; Mon, 20 Aug 2018 06:00:01 -0700 (PDT) Received: from localhost.localdomain (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id a14-v6sm1609051ljb.49.2018.08.20.05.59.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 05:59:59 -0700 (PDT) From: =?utf-8?q?Matias_Bj=C3=B8rling?= To: igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, javier@cnexlabs.com, hans.holmberg@cnexlabs.com, hlitz@ucsc.edu, youngtack.jin@circuitblvd.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Mat?= =?utf-8?q?ias_Bj=C3=B8rling?= Subject: [PATCH] lightnvm: pblk: remove size and out of bounds read check Date: Mon, 20 Aug 2018 14:59:53 +0200 Message-Id: <20180820125953.15364-1-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The I/O size and capacity check are already done by the block layer. Signed-off-by: Matias Bjørling Reviewed-by: Javier González --- drivers/lightnvm/pblk-read.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index f275c7e5abe4..d0fbd50ecc90 100644 --- a/drivers/lightnvm/pblk-read.c +++ b/drivers/lightnvm/pblk-read.c @@ -452,13 +452,6 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio) DECLARE_BITMAP(read_bitmap, NVM_MAX_VLBA); int ret = NVM_IO_ERR; - /* logic error: lba out-of-bounds. Ignore read request */ - if (blba >= pblk->rl.nr_secs || nr_secs > NVM_MAX_VLBA) { - WARN(1, "pblk: read lba out of bounds (lba:%llu, nr:%d)\n", - (unsigned long long)blba, nr_secs); - return NVM_IO_ERR; - } - generic_start_io_acct(q, READ, bio_sectors(bio), &pblk->disk->part0); bitmap_zero(read_bitmap, nr_secs);