Received: by 10.192.165.156 with SMTP id m28csp467565imm; Mon, 16 Apr 2018 03:30:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+2nQEU5CYSUXhjuG9Mm5cnp0YUrVl+51wXe7jiyDL9s01VFw+MUwaMI3i+ca0wj4Rzy2J6 X-Received: by 2002:a17:902:108a:: with SMTP id c10-v6mr4783521pla.171.1523874607894; Mon, 16 Apr 2018 03:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523874607; cv=none; d=google.com; s=arc-20160816; b=gu+SOHR8PFq64PHBkZTJBmFgq6FELvnewLXAMcM3kCVB6PnEJXt+9bD++HcwAm/o6L UBTMy2ksBVJLwmk5MSqm8dexlmzuZF7dwOxTjcw+jxhu8tlEC9VEt4DcbFOdyBzhXkPx An2i9IMXZxByg186FzLso+vEdz5tQ4k4ZgF9tgyFX+Iu9ea5QZKXH0JBOc1UP3gmRcvY RxYB4WM9I0YkBlKQCzuZLzxwlmCZPf47w5zzqKsqTNYTTezfEKxyFEGwStCvCbVySw5R vs8geJqL5RdlFeU0QePaEOxoGOhZJsTfTwVGF9Jweyktb0afvHd+Mqk5/dGGQW45IcHh jAPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=lkTJbH1zZFKZVgAwLvjriAE/P41U6j7U/Q9hTcXmhjQ=; b=T1/lBJRoQGS9qcF0lVe5knXpmGu9kCemJi66pCuAlQ3Eo94Ax2tq+mZYFr+GV5vhnT oVXWaRLUpfh7fDqYEf8di1+df84AHgvgL2stpV8f4pO4HhASQhUKHMmrqKoN1o41AErN OQs/SKJDKeFCH8cwXBZryPZ9Om1cGDVeag6V344Z+z7Ks8Z1J8SSC8huqOGN9FGmARqD wstX9cpLim9zHjVZMhWbBSC2mBvgnTarKyV+0jjIK3g5E63uEmxgCK2EQ6YHGTI69loc w9gwq/S6dzCCXgOQ7A4uhvw8WCSKeBXAxZNaECUzHE1E31aQWAq3MWQG4J2D6WCJirfh baig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=g2Fmkmdh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6-v6si11854726plz.27.2018.04.16.03.29.54; Mon, 16 Apr 2018 03:30:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=g2Fmkmdh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754730AbeDPK1D (ORCPT + 99 others); Mon, 16 Apr 2018 06:27:03 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:39376 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754134AbeDPKZt (ORCPT ); Mon, 16 Apr 2018 06:25:49 -0400 Received: by mail-wr0-f193.google.com with SMTP id q6so12351814wrd.6 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=RAGPegOGvyWrgmyykPKKS7sdJwy8mu1EnSd8Goha5BHogAnSPf+Niky4iix4kWhHqo T4c6LiSQw61bvWJpUzelkA9+3KGjEiIr3XHUpjdw4Gyn+2h8rLMZWN9wz2KoToXUyPWH gNxlTdFYJ3EiTecusg1hXGBwnqywAEW+BB2SMa7dqWfachquYF1a01hXxO+f3OX4RIz/ d32qib+1IHzF9DU11p5J2ugujF/NY5AEw4Lqy6M1xjkMqRlrkXvKKwN34JoJAiqM9RWy nIKL5gBtWarEixhnZt0KE3RZhAtindSc14Ck70z9IIxs3L6PVEReHMBubo8tdf2AfRA3 UhYw== X-Gm-Message-State: ALQs6tDcLdvHKPD0AKglJyH8OLrwb1/VK8REEL7tkPYycRqzCfZoMr79 8EtUV2UhJCwrn3YhelHNrA3H7of6 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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++; } -- 2.7.4