Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp18727imm; Fri, 25 May 2018 13:21:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqYF5FW66+5ADG/zft6sTtEa8wr+VI6V/OtjSoNW6NzIQigJbve0cJ6BrDJRUZIxvMe2V/K X-Received: by 2002:a17:902:9a08:: with SMTP id v8-v6mr4017877plp.148.1527279696835; Fri, 25 May 2018 13:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527279696; cv=none; d=google.com; s=arc-20160816; b=lTeSGJgrdw4jvulwcL9a9T6lG68lH6dNG5GOcGOf62QKqgmFWk3uGHlUS1wDeFaVnW TeZLzEFMhOZQVpO3iaXO630tKKG4LHX+O8X6DUEnmCtg/mi7HnC8ZLLVEbXZy4GwbXqU 7265I8p20BKWovIY+tu9xsv1nXTw/IVBJhvd7PPwt2vZnGe0gvy3o69J0SZnF5lSEIJj DKTcrmIOCaxyJN+JdGJ57GO2cPvn0eXVJXNhkwafvkiFmR7/vt8qyOdgC5C3SJcLEPyA XjZ0f2xqhmkn3WYmoZi0Wgy/JgI6q9Bn6ypbykGeYvbAgsiMaee2d9zWT4G4Haf5+chJ FFiA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=75s78JGt8ApdIaLGxvGEYG9kZ2NNtrHCFysV0ZWbhGA=; b=d9nDMQjPZzsMrmaGKhSkmv0eLALkgNe3C9w9RFhX4mhJH752/Ik4m8Hy/x09IoSX2Z lWO2ctEOFYFTcLo7P8gREu+QV0lBA75MjyxcwRyMErkyx8u0/u1hIq6fimLRKl9UF23s HOe3HtspFy6irdmqAq3tEnhfn5jkr61eYI/nK90ZISJruP1X3wESJEH7PO8/SqLt7O1p h+y5IW1zaA/ozoN0cQtOw6vxnP0MUm/2Fc3iwsEj84dEr8DiqtNf5O0+pUpBAXMs0vfd LC25EFnzTOAHrobmJUriK9sBouyn5aUXQglq2xhoICfpauakZBi0gEGn/O77A2gktmMV 7/Jg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sandeen.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si23965681plj.122.2018.05.25.13.21.21; Fri, 25 May 2018 13:21:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sandeen.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968184AbeEYUVK (ORCPT + 99 others); Fri, 25 May 2018 16:21:10 -0400 Received: from sandeen.net ([63.231.237.45]:54838 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967879AbeEYUVJ (ORCPT ); Fri, 25 May 2018 16:21:09 -0400 Received: from [10.0.0.4] (liberator [10.0.0.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sandeen.net (Postfix) with ESMTPSA id 0F59D15D99; Fri, 25 May 2018 15:20:52 -0500 (CDT) Subject: Re: [PATCH] xfs: mark sb_fname as nonstring To: Arnd Bergmann , Eric Sandeen Cc: "Darrick J. Wong" , linux-xfs , Martin Sebor , Brian Foster , Dave Chinner , Dan Williams , Ross Zwisler , Linux Kernel Mailing List References: <20180525151421.2317292-1-arnd@arndb.de> From: Eric Sandeen Message-ID: Date: Fri, 25 May 2018 15:21:08 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/25/18 3:16 PM, Arnd Bergmann wrote: > On Fri, May 25, 2018 at 6:53 PM, Eric Sandeen wrote: >> On 5/25/18 10:14 AM, Arnd Bergmann wrote: ... >>> @@ -1860,7 +1860,7 @@ xfs_ioc_setlabel( >>> spin_lock(&mp->m_sb_lock); >>> memset(sbp->sb_fname, 0, sizeof(sbp->sb_fname)); >>> - strncpy(sbp->sb_fname, label, sizeof(sbp->sb_fname)); >>> + memcpy(sbp->sb_fname, label, len); >> >> >> Hm but len = strnlen(label, XFSLABEL_MAX + 1); >> which could be one longer than sbp->sb_fname, no? > > We have an explicit check for that, so I think it's ok: > > if (len > sizeof(sbp->sb_fname)) > return -EINVAL; Ah so we do; I wrote this at least 2 weeks ago, you're asking a lot for me to remember it. (or to even read it, apparently). ;) Thanks, -Eric