Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4145153ybv; Tue, 25 Feb 2020 14:07:57 -0800 (PST) X-Google-Smtp-Source: APXvYqzshA2yfi0jo1lzrDA+HJWd0Y3ZPzozpA2TcKNHtN4ekjsD6u+gw2bRTnfXLFTS22VwBAF9 X-Received: by 2002:a9d:24c8:: with SMTP id z66mr622681ota.52.1582668477000; Tue, 25 Feb 2020 14:07:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582668476; cv=none; d=google.com; s=arc-20160816; b=dCj7+dmzY+0u7wMl3rfJi9xtE4jyHi76lNXFkFPAjA9yAOYUqQRPNdkwNWtOZV6Fje G0LjMC+E8588V8HNhYLZ9DakFmmgIOAbmHctprfD5/9fAWzXjVpCfC8d9XK3MIN5TN51 fKDirh+NfmT3Ua5wp0H7HW0WMWVC3nFo7ByEHpBvZ9EN5QZxhFfZHu/gsayP7A5mo0MV kPQueLnAtCrRoLNuo30kCnxiyuZSjcgXLIrGenqXYA5hyLSbqmrmbnfMXb0nJicB8aas 2yj7+wwPByW4nuYECljxiTDqTRHqURAq7oOTONT5SmQ3rxkQKheH7MB0Of7PdQzDmaqp lRzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=B0GGCh2XIGmqORJyjBDP7KACUGN3IAIqTyDSvWyLwz8=; b=uWeTHDy5jKg45VBN9sUObuN7e0tNQKyJVEmrqpqL4a8iX0UG1jrHx6leuVKDD+z5Og 17c6whsUW0zjcNl2ukpi8z3EH+GCtSlKTDbUZucLJb1TYTNWRGcRbrbnK6277EfXJG5A azRtvMnb/aLe6QB8D3aCBaJm9sI7nl6JhwtIehyLJ+NpOvhAA0wloGlFXMLmhryRsJPW 4JWTlqXCGXP5T49VjPC4wxRD6xygZaBFQCmCWw1hgibB6uQedGSDTzz13xbIdcO1TmRU NsxT4DJcwioGLHM9wfgAv8QFXgtXQvqvuyXUvi74VerZhGdZ1XcEhpibrOn1xjBRUl4a 0E+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=PZ00HG4u; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d197si36911oig.115.2020.02.25.14.07.44; Tue, 25 Feb 2020 14:07:56 -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=@oracle.com header.s=corp-2020-01-29 header.b=PZ00HG4u; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728162AbgBYWHf (ORCPT + 99 others); Tue, 25 Feb 2020 17:07:35 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:53438 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726607AbgBYWHf (ORCPT ); Tue, 25 Feb 2020 17:07:35 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01PLx7eg003863; Tue, 25 Feb 2020 22:07:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=B0GGCh2XIGmqORJyjBDP7KACUGN3IAIqTyDSvWyLwz8=; b=PZ00HG4uYdKF4uNrW3hYCu4XCxxu+toXWHsgYoYxFDHwmbZlR6XDGv7tFPqh65lQ3sF8 XEX356yjIlvMH63SCNztuvi1DAhZz5nZfUSZ3IWm1zEoaScC/OOzB/9LfY88BuHKDl/1 dJfQWrq79j8RmqQO0cd7YtGDC2ep74xC5nB6hOcu3xIb22HTMiu3PvnvJITI8EvL2PpW 53mFk4Xn2yTiVMOyc9j7N6YV4jLK/3NH0kgcXL4NTSJcY0OR3/fe3UMPzUJDrWHdewss LA41vgGBHwNUsXuBbGv4Ycf02MxZVmJljCAbNd3te9YOrR86e+Jl635EBpNzeUa+smkZ yw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2yd0m1vd4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Feb 2020 22:07:30 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01PLwdZ0035660; Tue, 25 Feb 2020 22:05:29 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2yd09bmf2v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Feb 2020 22:05:29 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 01PM5S0X006632; Tue, 25 Feb 2020 22:05:28 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 25 Feb 2020 14:05:28 -0800 Date: Tue, 25 Feb 2020 14:05:27 -0800 From: "Darrick J. Wong" To: Qian Cai Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] xfs: fix an undefined behaviour in _da3_path_shift Message-ID: <20200225220527.GX6740@magnolia> References: <20200225214045.GA14399@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9542 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 mlxlogscore=843 spamscore=0 adultscore=0 malwarescore=0 bulkscore=0 suspectscore=31 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002250152 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9542 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 mlxscore=0 suspectscore=31 bulkscore=0 adultscore=0 impostorscore=0 spamscore=0 phishscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 mlxlogscore=892 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002250152 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 25, 2020 at 04:55:56PM -0500, Qian Cai wrote: > > > > 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? Please send a v3. The code in v2 looked fine to me. --D