From patchwork Mon Apr 16 10:25:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Javier_Gonz=C3=A1lez?= X-Patchwork-Id: 10342627 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 9D37260365 for ; Mon, 16 Apr 2018 10:27:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DF5C20121 for ; Mon, 16 Apr 2018 10:27:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 828272863F; Mon, 16 Apr 2018 10:27:30 +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 195D220121 for ; Mon, 16 Apr 2018 10:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752952AbeDPK1D (ORCPT ); Mon, 16 Apr 2018 06:27:03 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:45973 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754115AbeDPKZt (ORCPT ); Mon, 16 Apr 2018 06:25:49 -0400 Received: by mail-wr0-f193.google.com with SMTP id u11so24436852wri.12 for ; Mon, 16 Apr 2018 03:25:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lkTJbH1zZFKZVgAwLvjriAE/P41U6j7U/Q9hTcXmhjQ=; b=g2FmkmdhyeFIyAVGFpCd1QuJ/19IhCpodrcGM2AYDPxwacoXfEGu1/oAYaRcECjOc+ Yb54+tCcMUvsSicC5UzGDnvyItFHDyygFAPl4DP0WRj1JSutWrFHiyAoFAz28/dqxvAX CmW/mrXpfUunzpVJ9oxo0oBlLr8/23b2v+yUWktKd9DLf0jxA8pXaIhYmUu0Pb41e3Gw OBiF5PZ0GeGr9U0YwD/7T+hkaMjzRRhTL9wcKNCeonP0N80pDfHLjwhYOvtxln9FbtCs QWa4MeGYX+7IVBd4wSYReQDuiPlfJheBHykHgp7rRmWSm4kRqFLFLeG8O1vMnNtx+M0D erKA== 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=lkTJbH1zZFKZVgAwLvjriAE/P41U6j7U/Q9hTcXmhjQ=; b=PXS69r0O3M3ivkUtqXzujZVSGrVZHmxYweBKaLr0CLBhEPjh+LzRteQ49UcIN2z1uN mOdbU9gMEcULmv+TvJi+QElLYX/K+igHJ5O8eON0rYJAvfwS0OKlRfPi0STzGu19nV2v PtyJ55GmS3dSO2rr93j+L/mEkjgOOm77/FsgdhZ2Syrqz/fUY2ZupbRp8omzHH+N6JHf BjYdBqp0IS7BVZcD3r6mgGfD4D+eRUg/m998DGdwhQTDupKXRHhnsE2pS9dJ4zczXsc5 EGgOpeeXlSTZvRwVU3Gn12NUZymJDu4U7E+uABDOkKGodGQdyNpESKZJWmoz9P5XpVcp AKZg== X-Gm-Message-State: ALQs6tCx/TmYkEUYPfpYGHTN9cfeM3kNR78gL2tEVAfMyvspeGdTm1ja oitBvbx9L4HtFzhCFapsDoDdHQ== X-Google-Smtp-Source: AIpwx4+LPRvNrEm7zrwOJTeZYEH0SY+a2cnPZjWd1oUeow0getoPuzR2T2E+R098a/bn2PItENd0BQ== X-Received: by 10.80.171.72 with SMTP id t8mr213314edc.133.1523874348530; Mon, 16 Apr 2018 03:25:48 -0700 (PDT) Received: from uhalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id q11sm4250074edj.2.2018.04.16.03.25.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Apr 2018 03:25:48 -0700 (PDT) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 09/11] lightnvm: pblk: check for chunk size before allocating it Date: Mon, 16 Apr 2018 12:25:30 +0200 Message-Id: <1523874332-6272-10-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523874332-6272-1-git-send-email-javier@cnexlabs.com> References: <1523874332-6272-1-git-send-email-javier@cnexlabs.com> 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 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 --- 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++; }