Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3823207ybl; Mon, 3 Feb 2020 07:12:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzRXosEFZIDbvdPDD+9ZsVviptkJ1L1/AHRvZAztD1+egio9c6J3dspdLUGCqFhMsyf0qoT X-Received: by 2002:a9d:7e90:: with SMTP id m16mr11781711otp.227.1580742764378; Mon, 03 Feb 2020 07:12:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580742764; cv=none; d=google.com; s=arc-20160816; b=mY8swpq8fXPaVIiI/u3eF39oWdizZ9no+FwQw7t4gfVWA1oTQMgF6Oe7sCmCrdjX9J JDwCbxWuXBikOg1J2ECobba9EcGrMn842KfC6IXx5XQtmOjkaymH91Mkh6ynQPFUC8PE YlqluxMkg0MqGHJSw62wy7qnSYCFLgxFwBb/g20juEu6qmf/JFMtoCMQDxl81HiT1+Ct m/XKYoDwn0paIE9hQUz8c5dTBjdMUXoKWBwk07hufH+loc1/4DILu6sYhENROtr76SI6 pOPGYEwVSa7w42W9soj0E4nIsxc+T+s8r7hjJtSKEOwtZxXvbhkYEITNZHO2ZeHGC/n2 E8QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=qbkYCWeftWJMsx9+tYjRuDhA2q9w+ZDbpACjvzT72sg=; b=TjIPbabYtgexb7XPRFleeHzqO8bSoUUnC2N60Es8GDtepp2bDl2qdhVg20q/O1jbYI +JkalVT9+/RL11BzHrjerH1sI0ThAKwFYZxNOUow1R9rG1K3etrs6kk3HeS3kt/3z97z Zo/kFXG4nIDyaSLzEgvc7mrnBFIlKoE2PJfM9BoPsoBYL4LUfoad4Wf1bbAa00M8e4DY A3nSIaxZr6KG3ObGa9qb/Z5HoDs4LR0GFARl9bueKekGMYjhuVC7ccq4pxMgilO8yDCz dxE55g7qkDIOsFs1lRI+uvIlTcs20BCd0inqF2nU+PAYRT2379PkcwFDiuJUMK7/iqrW gilA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FCk2MCD2; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si9817624otq.298.2020.02.03.07.12.27; Mon, 03 Feb 2020 07:12:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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=@redhat.com header.s=mimecast20190719 header.b=FCk2MCD2; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728059AbgBCOW2 (ORCPT + 99 others); Mon, 3 Feb 2020 09:22:28 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:26387 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727830AbgBCOW2 (ORCPT ); Mon, 3 Feb 2020 09:22:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580739747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qbkYCWeftWJMsx9+tYjRuDhA2q9w+ZDbpACjvzT72sg=; b=FCk2MCD2xX/yzy3lozrOprnCJhQxmV9KJCkjWBWSYu0cFxCS+mo1IRrNGcZOTUAlXzV39I m614O+cHl5hJffn+j/zNlKWk/8GknYyCrCuTM9CbQCiBxjtKIdzZYBT/I6p2V2Nf3/qiHj 3zyJqryiezTKWw1T/s9TQJbqIdVR+aE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-KTw8r7vFMe-k8Uz3DiDjSQ-1; Mon, 03 Feb 2020 09:22:25 -0500 X-MC-Unique: KTw8r7vFMe-k8Uz3DiDjSQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F5FF18C43CC; Mon, 3 Feb 2020 14:22:24 +0000 (UTC) Received: from [172.16.176.1] (ovpn-64-2.rdu2.redhat.com [10.10.64.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F1031001B0B; Mon, 3 Feb 2020 14:22:24 +0000 (UTC) From: "Benjamin Coddington" To: "Trond Myklebust" Cc: "Anna Schumaker" , "Dai Ngo" , linux-nfs@vger.kernel.org Subject: Re: [PATCH 3/4] NFS: Use kmemdup_nul() in nfs_readdir_make_qstr() Date: Mon, 03 Feb 2020 09:22:23 -0500 Message-ID: <1FED506F-5AC1-4418-8989-B139B05B8F90@redhat.com> In-Reply-To: <20200202225356.995080-4-trond.myklebust@hammerspace.com> References: <20200202225356.995080-1-trond.myklebust@hammerspace.com> <20200202225356.995080-2-trond.myklebust@hammerspace.com> <20200202225356.995080-3-trond.myklebust@hammerspace.com> <20200202225356.995080-4-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 2 Feb 2020, at 17:53, Trond Myklebust wrote: > The directory strings stored in the readdir cache may be used with > printk(), so it is better to ensure they are nul-terminated. > > Signed-off-by: Trond Myklebust > --- > fs/nfs/dir.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c > index 90467b44ec13..60387dec9032 100644 > --- a/fs/nfs/dir.c > +++ b/fs/nfs/dir.c > @@ -199,7 +199,7 @@ static > int nfs_readdir_make_qstr(struct qstr *string, const char *name, > unsigned int len) > { > string->len = len; > - string->name = kmemdup(name, len, GFP_KERNEL); > + string->name = kmemdup_nul(name, len, GFP_KERNEL); > if (string->name == NULL) > return -ENOMEM; > /* Reviewed-by: Benjamin Coddington Ben