Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4135110ybv; Tue, 25 Feb 2020 13:56:28 -0800 (PST) X-Google-Smtp-Source: APXvYqy2yXI066LwiGBEwKq+Nu9AtAgPxN0CAm0UkCQH2AygbtCuxmvjRRUuqtfAuFw6w72Xmw8Z X-Received: by 2002:a05:6830:140b:: with SMTP id v11mr528584otp.340.1582667787992; Tue, 25 Feb 2020 13:56:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582667787; cv=none; d=google.com; s=arc-20160816; b=ThRbOWE/bH6NtTU+pPE5OIlbhgWB2ssDDZbGxWM3wHZP4Z1UgjTm0+PFm5gG+ZSVX7 FMcjBdPJWfb5nO0ey3QzrHTL1UL3doFoerYOB3+NQVmFHWP/npr1q2d81sYa7EPZBmCb WhpCXXyNWyitxlashY/4jnKSnZfS7egiwSRgZbEVqZEcVyrrRXz/hTCJIgwQkOa3T/8G 6uOpbpKxtT6txO2NShCax3KCNtDF3Z37ebImInFWC46udQ5EAH05RY22Bdfw2CPTzHbE AF/9THqe9hUj+pqZ/v4Ok6LD/eOiBwHIwyveQaNF/2n6qMGSppwWMjbOyCrlXh2R7N+8 NE2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=C8tXnjBIgXhQmik6V01XoZCiutz1pInKjAZnnialvzs=; b=BMld7UyK/IXEbhlq2UygXhQCEitrf5DeK4FEq7Us+n9i5uc1okdKAGYuuBsUKZ6JJs FnA3HiO9JejLy6rz4p0/UCH4fXtYlCvjI6ay0bB8waV2BP4tjxUguE5VdjIeF8MxBJpX 96BvIwWSeTOtY5XbCNQ5LdS7UjKiS0ppXWgB5HcrydbqN1RtniyRzjAhy7daPwCFo6eY 0LfSRjaeIBt1AW7WYaukFnBApPUXdmj2bBV7k4+PBE6L38IT9rMH875UA5y6ShCvS85s WgiXGGTqkYwupo+slInPb/2PyWTfWOu9DYkmqGxePXBmFT+4o+UnsA3x9RjYMYZuWqK3 z6wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=bBjNplWy; 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 t184si10052oie.165.2020.02.25.13.56.15; Tue, 25 Feb 2020 13:56:27 -0800 (PST) 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=@lca.pw header.s=google header.b=bBjNplWy; 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 S1728806AbgBYV4C (ORCPT + 99 others); Tue, 25 Feb 2020 16:56:02 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:32891 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbgBYV4C (ORCPT ); Tue, 25 Feb 2020 16:56:02 -0500 Received: by mail-qt1-f195.google.com with SMTP id d5so816147qto.0 for ; Tue, 25 Feb 2020 13:56:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=C8tXnjBIgXhQmik6V01XoZCiutz1pInKjAZnnialvzs=; b=bBjNplWyyCrqAUpuEWmZ2tK7IJIcfZIxvmc9JcrzLs9vOpSuWqAgC3YEhCajpARc9d w0AYS2sY0ySMIbmYG26KZHOkre6asZDZzVjvXsCgWGCTHP2GFDUZYmaZH6DleB2x2lyM 8SAzy/D6s7PhDXPeR78X+egGb+MDrUjHHRBJozSTI8T9iPw5RpYz6mRUvczCMye3Fk08 pysDv6iXU0lgq2u1duoRF3+J6B4+suUVn/Y2PH07x+XLyI+Cb7kry9j4CywVwTD3eGg9 fkIDiZ5GM1OdJ8G3JuU/WBR/4FwSZ+5zjPH6k4fgz1w5CjEezPy/6ihhoH4xJnfjtyIB /9Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=C8tXnjBIgXhQmik6V01XoZCiutz1pInKjAZnnialvzs=; b=bwq0jgszzacR2XJu4MrcqXtSM0BRZPi2LAAU6A/+L1gBNAUuRxvcGoNwa0rW2g9FFb 0evMTb6SpU1i+nCbbzYc0hWZrWuXl7b0pj5F/pgXX2mn60d9JZANDBCRkh57oKCwg4KL bnyhRmA+P20Rjw+cYs48YfIOe87etccvYTP1nmAPuYxcYwM+6tKvAuFH5WZfyQnWx1m9 ES8xHO03nmvP7xRDC3nKWCVqwHVNj/6olytR6xvY4TQ4/84HveRaXyKjwUI2h5xuSBOh S2UISwUvQRgI+ZB+7+8tedkfXXEpV1/FnP0CuHoirA38mnfvjzK9WYMqT+owHyytpO/I 0PvA== X-Gm-Message-State: APjAAAXeXJgPA7GdxY6/TGOPTCBkgcwMGyQ6kTImVtQ+6Fk20bUBjy+P OVrqp8pLgpv/htjIG1UKr17HLMeo9i7rsw== X-Received: by 2002:ac8:70d5:: with SMTP id g21mr940800qtp.46.1582667761333; Tue, 25 Feb 2020 13:56:01 -0800 (PST) Received: from ?IPv6:2600:1000:b055:f4c4:c87c:3bb6:b6bc:1aae? ([2600:1000:b055:f4c4:c87c:3bb6:b6bc:1aae]) by smtp.gmail.com with ESMTPSA id 131sm3148669qkl.86.2020.02.25.13.56.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Feb 2020 13:56:00 -0800 (PST) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Qian Cai Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v2] xfs: fix an undefined behaviour in _da3_path_shift Date: Tue, 25 Feb 2020 16:55:56 -0500 Message-Id: References: <20200225214045.GA14399@infradead.org> Cc: darrick.wong@oracle.com, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20200225214045.GA14399@infradead.org> To: Christoph Hellwig X-Mailer: iPhone Mail (17D50) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Feb 25, 2020, at 4:40 PM, Christoph Hellwig wrote: > > In xfs_da3_path_shift() blk can be assigned to state->path.blk[-1] if > state->path.active is 1 (which is a valid state) when it tries to add an > entry > to a single dir leaf block and then to shift forward to see if > there's a sibling block that would be a better place to put the new > entry. This causes a KASAN warning given s/KASAN/UBSAN/ > negative array indices are > undefined behavior in C. In practice the warning is entirely harmless > given that blk is never dereference in this case, but it is still better > to fix up the warning and slightly improve the code. Agree. This is better. Darrick, do you need me to send a v3 for it or you could squash this in?