Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2415343ybb; Mon, 30 Mar 2020 05:47:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvALgY1wlvjgC6hOS9EYRiGIxv0AFrOBrj46XhdyzYiUSmt0qu3NVKHQA2qua3htLGuZP+R X-Received: by 2002:aca:4843:: with SMTP id v64mr7158881oia.13.1585572440176; Mon, 30 Mar 2020 05:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585572440; cv=none; d=google.com; s=arc-20160816; b=alaB/irGQlf2/Ic+62VBj2U3sOs884BLGOk9BcS8wEz0HeBJ0jihCmkUzE1PD8+KJz SMYROrEgR1Rhq9z+r8ud1MAODwVyi4Ijft8fT4mvPczXwXFUQ0u5+VBjpb2sRki/BBfb 9Rl9z4xVet8+ZSqvXgGHchV9AH2K5rsfhg78Wqbg4dSLrwiTGGOfdtJFDfHMuJa06V/l 1AejLBbpCyMkdJ/ufMYtGffgKoJvqcbKJ7oTiRaP7mexq/kLbYuHWMBMmHOa4Jw5evUT /mdt7WYhijtyx3T9VQKfMW7hBzBENnTLbheV23kzqlVRMFnmqUw3XnBcX77wEJ9xQfBy ClWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=uf0TDgv1/qWtsH3KLO7savy+BV3YM3XxU5+nWmfqf/U=; b=Niqrql5/G6mAtD9XVB0GnEx94T8lYLNZXvDwS5dea0NUlU0p+/Qz0i8pY2Sg2EbBxb yNQHC+3l+wrk7snx3mzJXohfm6GmhpPUexZc0qJcInpipeT/uGxdaWCzkkT/5xLp7rUd x/OqX2KPaYoVSukZtNbMZ9kP6iQs1f23Di5FiYUS1BBo2h+GeqLZrB186v3hrSUUpDkF VHIAV9OD9kJalya9ei1gfY6wRaW3T+AFTQ1ta//2Jgj45rYSKlmukIyh+0FfZiq5o5OY /S7lpPzV/9bz6kF5Hsntq39+ajFQNip0wP+71x2ODlq2dymEnYdYM/ZZBDE+ObHIBnsb 1yGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pi64xMQ+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si3895910otp.239.2020.03.30.05.47.07; Mon, 30 Mar 2020 05:47:20 -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=@gmail.com header.s=20161025 header.b=pi64xMQ+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730250AbgC3MhR (ORCPT + 99 others); Mon, 30 Mar 2020 08:37:17 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39532 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730227AbgC3MhQ (ORCPT ); Mon, 30 Mar 2020 08:37:16 -0400 Received: by mail-wm1-f65.google.com with SMTP id e9so9778276wme.4; Mon, 30 Mar 2020 05:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uf0TDgv1/qWtsH3KLO7savy+BV3YM3XxU5+nWmfqf/U=; b=pi64xMQ+vFHsfxixMKtMcBQSGKBdz5o3dNXDvpU39w9dLPmxx0JUvHzNhnRxrVBWBD L/Wc1ip80v8dBBAvskXs1mHj73E1dh0LnhTixL67A6MkuYn+FFRljKmp/s01rPCNeg3T h7NkCBoy9V0ESrXxEDON1H6d2JO65RhCBA5XTBBwttCn9euPFG1R2sSBxeb3GcGpJ2Pi 5bOTOHnZwWM+Q+6HYLAlhvusmYdQuxkM7EhZ5BMCcS38oM0KjlK84ZvK8CchvCt28RQu 2vz2Lt98FFJcxlW8fvw7iSvTjovbUfQbuan0mpHvSSok4lAVMxbBX1zAMWW0wufDIgDM FmTQ== 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; bh=uf0TDgv1/qWtsH3KLO7savy+BV3YM3XxU5+nWmfqf/U=; b=TeshRPXXkKLU9fSZpCYq2A6UoHL0uYsuM0+r7yESOra9IK0mmTBD1Et0/vdjTzGLJt 10cMTXc/kzZYkK3C2k08JVnprGgQCIIXicM5Jjrrrft0gS71JCnSGloOoGUaC5ZIeiRZ jJIMYibd2lEZJk318mfM/9ggOFkQUyBjG2w33wlluyM7VVPT6GlEVVHF1A7va3Ffwdjv kkl1q1DCgT/QTZafORz5nP3SUs2OVI6EM6CjbydkaMLfj90wmbotpAEUGzbC+OYM3Nyt d2tleSnnbzq5kcx5nWRY7IGI3ttv0x9pZpwkIeisZrxEI08Ot0IGzXstT/sjfFJPu5kl 43zQ== X-Gm-Message-State: ANhLgQ134IBfPFSqfrtYH6pl6KRRJJpJOBWehAq0SvwIk0RdlcrgiLaA 7zhmeEaMpnDzezQeaO9Sg47EMEic X-Received: by 2002:a7b:cf09:: with SMTP id l9mr13275910wmg.11.1585571833746; Mon, 30 Mar 2020 05:37:13 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a16sm19889486wmm.20.2020.03.30.05.37.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Mar 2020 05:37:13 -0700 (PDT) From: Wei Yang To: willy@infradead.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH 4/9] XArray: don't expect to have more nr_values than count Date: Mon, 30 Mar 2020 12:36:38 +0000 Message-Id: <20200330123643.17120-5-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200330123643.17120-1-richard.weiyang@gmail.com> References: <20200330123643.17120-1-richard.weiyang@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nr_values is expected to be smaller than count, use a more strict boundary to do this check. Signed-off-by: Wei Yang --- lib/xarray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xarray.c b/lib/xarray.c index 1a092c87fca5..e08a0388a156 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -744,7 +744,7 @@ static void update_node(struct xa_state *xas, struct xa_node *node, node->count += count; node->nr_values += values; XA_NODE_BUG_ON(node, node->count > XA_CHUNK_SIZE); - XA_NODE_BUG_ON(node, node->nr_values > XA_CHUNK_SIZE); + XA_NODE_BUG_ON(node, node->nr_values > node->count); xas_update(xas, node); if (count < 0) xas_delete_node(xas); -- 2.23.0