Received: by 10.192.165.148 with SMTP id m20csp3555069imm; Mon, 30 Apr 2018 02:12:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpcJuniXbEwyEWs83OzxnasvPs/1+vl5aTTdui0+Dryd0yOS3+Wdb8OzElyLJeXPYiyuOh2 X-Received: by 2002:a17:902:6786:: with SMTP id g6-v6mr11584253plk.362.1525079577004; Mon, 30 Apr 2018 02:12:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525079576; cv=none; d=google.com; s=arc-20160816; b=Q/vTZtwgEA/R8MO7Tv+B0RQnW7gV6UfH+rZBU+4NVJoJtUUtgjZ8PgWvrcq9Wq+If1 +wg7XO/e7Dj1AdUNjhV8C15+0+X1e9cWUIV4yRDJhdi+bJs4R6pFQ1eZG34CzRGeYJtE ztDx3QEhGbO/0v0oh7Du4h+Iv0YEUMyJD8Asu9Pf07ATfEDow7v7feCTnPlL/cfkTgm8 r2oFH7956Oc9YsejP/RNn3ZtEz1PhXRcxAXsrUVNLtt8/CrS9dTIy0s9DKD8XjPrZ6Bw qsIPb5XX0GRZNl5+4lvE5AbulgqwWHqqU2iur05nkowCtbyIrVbGnIi3+bAniQWlVmIJ 7bSw== 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=ra2zAqFtyXQEaJRbYuVMiUlRMoPJS9J6rsgZ+ASttkzjEZRPusrMf70NoXtuXzZVJd Hoqqk986SOqydMljBWwXJyedoVJLpE/YztOBkl7tv5+CYKZy/+XJz/HtqCPmFhT0gskT 0X9oUwR0bRiOdCTxnVAlfe8olq6HCeFmWnKyz0UvAAndbwmZzVn2RWku2PKmfOzSQ9Km OuA9lXmpXAIKGOlzI7J98G+zHDEu7R6EXXi0oob4yOVpfoE+RKzF65GDoLZpFCmcGXSD BEm/MrSPTS/FISt5OZABl3DgQf7JBK6MA/jf5qwHTssKpSa3RQuwnYrLeMGWo3cadCo/ l3Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=hRkpzhX4; 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 u71-v6si5922158pgb.332.2018.04.30.02.12.43; Mon, 30 Apr 2018 02:12:56 -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=hRkpzhX4; 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 S1753858AbeD3JKh (ORCPT + 99 others); Mon, 30 Apr 2018 05:10:37 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:32952 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753811AbeD3JKZ (ORCPT ); Mon, 30 Apr 2018 05:10:25 -0400 Received: by mail-wm0-f66.google.com with SMTP id x12so10640706wmc.0 for ; Mon, 30 Apr 2018 02:10:24 -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=hRkpzhX4E/yINTe3Mw6bsZ1tX2gpLWc4hIQ5BCpc9lpoeUYT615palIeJQ63deSSKG s6DS2sV8UX1NN80Ed0Ee8Dnsu7QoAuyTQ4Tm1xZm7cekgB8Q+Ku6H3L1RJSKnsZZBJ3J Crueemee/JbPHg5EPeI6Eru1g4eMScKl5Lfu7fkAH6BQviLZi0rMsXJigg7bZNXTtnz0 wVjk/nj59els3oZpFcqiF10zy/zlwvIcMrWXTMBjXFZkT4VvN7a07GNgM3uoEKSU1++w j0px2rQG7zE+YMfdFrF7Orfk1oVttiYRIIsFjuAeD6RGL3BdM6/GKPMU1uEuRToBnBYf YNZQ== 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=gLVYoCPJOum5JgoJyPoq69/9c0ORgDYuGWk2Nhiewl0lNYYvoxUJt71Mz7tUe+9ASA qKf8+48/XHn2T1DQwuUh9kG6QMPF+xbYW1dora2Dm2enlnEXX8hVq+Uf8u0i8/EunfRK xiCPktWGUaDmlwnzEm9wFrxTpL6ZtyH/YbcOsPfCzoYKA0dsXHKjE/f0i+YTjshhsXvC UlS455gqyt3p8aFIZu4TqRzRuCbA8CF3Vpk/kx9BV/g22QfAdAyDz3eSsNf6Q3iaFR9O AKAfGKPQzUV8IEgJh+4DMEHoLf0amsCntAj3ILGtWBYXiLQ1peJw5fkp2mNM0bJGFg3y XjlQ== X-Gm-Message-State: ALQs6tB61piaQarT8gbXYvCG6JOaPZ615NZDbU5YDy9z8pTRvWhg+Tms /9vKYWcA6jX2MwQ3Fk0o9hEQVllG X-Received: by 2002:a50:b706:: with SMTP id g6-v6mr15118748ede.228.1525079424277; Mon, 30 Apr 2018 02:10:24 -0700 (PDT) Received: from uhalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id b56-v6sm2108638edd.85.2018.04.30.02.10.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Apr 2018 02:10:23 -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, 30 Apr 2018 11:10:07 +0200 Message-Id: <1525079409-6588-10-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525079409-6588-1-git-send-email-javier@cnexlabs.com> References: <1525079409-6588-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