From patchwork Fri Jun 1 13:04:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10443375 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 286B8602BC for ; Fri, 1 Jun 2018 13:08:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CB2B28D9F for ; Fri, 1 Jun 2018 13:08:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 113E628DA5; Fri, 1 Jun 2018 13:08:05 +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=unavailable 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 C3DFE28D9F for ; Fri, 1 Jun 2018 13:08:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751842AbeFANID (ORCPT ); Fri, 1 Jun 2018 09:08:03 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:34281 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752162AbeFANFE (ORCPT ); Fri, 1 Jun 2018 09:05:04 -0400 Received: by mail-lf0-f67.google.com with SMTP id o9-v6so14736777lfk.1 for ; Fri, 01 Jun 2018 06:05:03 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=pUgpTe5N+eIkbhHMh5mZ3uG02wTbwA/rNVB0WiNn0cU=; b=fB4+kYgeObVjImA2Y1MWVC2RPPMLYro7ePO4CZmE5EcQFxFbuV7WabnrDhSXquIa/k 63AxznjPcTgChLKG55maijRcGvmNJLtGCcOoJZAnqKS5s2JHmdMhtLiDSeCNgetpx2mL 1+7bO/U3XgcZZqIlx9Lpr2IZniAXHE5CUSgmcIVRqfE+0G+z5d6/vDT+DvMsISZk42MH WBZQD5e7fZRd9bAMQ4doxBcNlYbuOMIaiCntCYBN8m55l/Yl5jOACTyaEqv/DqIrqXDh 312unzxQfpGcTcEunN26koPABYgK9hEEf/M2jjv3WkgXFFB9pVMA0TeM2Zl3EngoZprb DZlg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=pUgpTe5N+eIkbhHMh5mZ3uG02wTbwA/rNVB0WiNn0cU=; b=MHCWeM6xVfbzcsrDt/C+z3HDf8GSkS53foUgcg75+bPDMlzEauEDTbRhhv7XKuyIJN gspIIFNXlx0yKctGOSxDQffUxD3NI7ZAig5v2eyEvJep4gx8TWhqztLhC7bTOiMLhtcq xM7M2U60WygSy2TzQHIR53OO9gAoGB2OpYSlSbU8nuN7tKD+mlO/LwoZVCDcK2izVlNA G68PfEhiR8a3Lp3UMoBbrGdYdxPCEhY1ICNXaAWVLDCihmrlMXxroAwZxwD0pSdjCJGr 9d7YUp4MJv8W8gemsRYgoDucWvkqssZpgscV6IlJAH4w6BIXG4Wu+00QegF509eQl8P+ /Baw== X-Gm-Message-State: ALKqPwf5SUJ7zzTXLcFUiqpFKbcWMdpuGVqh9v4mDS2sA27sBX1tIfpx 69q25OdS88HPzKxU5oZ5gIKezw== X-Google-Smtp-Source: ADUXVKIKpI2paU/O0Q9KbihP5qL7KPeXlFHQw5R2oktZqqfWrEMHyOJi91dRExLlkms/mXFcp2tppg== X-Received: by 2002:a19:cd52:: with SMTP id d79-v6mr7139187lfg.41.1527858302933; Fri, 01 Jun 2018 06:05:02 -0700 (PDT) Received: from Macroninja.cnexlabs.com (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id g5-v6sm303161lje.21.2018.06.01.06.05.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 06:05:01 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, javier@cnexlabs.com, igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 09/18] lightnvm: pblk: check for chunk size before allocating it Date: Fri, 1 Jun 2018 15:04:23 +0200 Message-Id: <20180601130432.30866-10-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180601130432.30866-1-mb@lightnvm.io> References: <20180601130432.30866-1-mb@lightnvm.io> 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 From: Javier González Do the check for the chunk state after making sure that the chunk type is supported. Fixes: 32ef9412c114 ("lightnvm: pblk: implement get log report chunk") Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index b52855f9336b..9e3a43346d4c 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -751,14 +751,14 @@ static int pblk_setup_line_meta_20(struct pblk *pblk, struct pblk_line *line, chunk->cnlb = chunk_meta->cnlb; chunk->wp = chunk_meta->wp; - if (!(chunk->state & NVM_CHK_ST_OFFLINE)) - continue; - if (chunk->type & NVM_CHK_TP_SZ_SPEC) { WARN_ONCE(1, "pblk: custom-sized chunks unsupported\n"); continue; } + if (!(chunk->state & NVM_CHK_ST_OFFLINE)) + continue; + set_bit(pos, line->blk_bitmap); nr_bad_chks++; }