Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp561969imm; Wed, 1 Aug 2018 01:13:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdMMZ2QS5pdp3W2fl0fyJM4un01HKUOB0qzCb0FIDuKt+JI/pYUUzyOlA9TZUiA4NUtg4ye X-Received: by 2002:a62:c90a:: with SMTP id k10-v6mr25352016pfg.180.1533111194712; Wed, 01 Aug 2018 01:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533111194; cv=none; d=google.com; s=arc-20160816; b=BfYlBr/bSgoFG5MB5f8dXMLjkuYjNlUziRxcV6sb6P8qMGO4PbWcYf8MfzeZQobPMQ 1HXlraNtG65Cuhq5Miu+Yf7bLN1UHFhCKmIYedNdYu8SbKmKJZkC1HZfNlKBvvxhvJFT zBlWuwZnMPUCKLyQ5siJ3ZAWn85Ac+363IOs6x3PFFj3wK2Y6OcoZ3O31FGv2r9dHRBh jj252w3Iq2ESBojTxMNtZPerAHpK3Oa1+nNS9JxZhnU0Y94ww8hG4ids5VHuwJeAcjb1 1UVsE5jdLUYZET1o9gzndpGifXeD0lD6k9tzdHtFhWmsB9tJtcp8Ir6TiK2UVLGOmD3D mpgg== 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:arc-authentication-results; bh=bKPw+H0oO3o5DPZMdmfOhEPgxEyxQaEo5GIFzBZjbzk=; b=Y5igvwnUxiLaDWudPmRFaK4KEElNKaFYf9GLNoqjiwwTuax12pw3cm+QHal8wJ0m6h DTrkSjo5HaOG3KctyH811/aQ6d8GSXLbQqBw11sDjV1qNmCOxY8QNxaOXPd9VzlU84RI b7uGARsxSdBvJ35nwBQ7XDmoAR7P0pA3rayNlW7l1cFs/dPbqs2yhThzBhVj5g4mlRsE /6I6sQLTXYovvpqi+SMBF8CAfi0ZW/sQi1bi70jOpkCqzEqNPbUvHQ0L5QXMSdTlHlA4 NYmKFN3G3WytprGcS5EePJXF21N0Y3iE3AucTsUfnh2GeZVp25KmAjQZUWQcHN9PHsN2 EFgw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21-v6si16027143pgl.235.2018.08.01.01.12.59; Wed, 01 Aug 2018 01:13:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387739AbeHAJ4n (ORCPT + 99 others); Wed, 1 Aug 2018 05:56:43 -0400 Received: from nautica.notk.org ([91.121.71.147]:42637 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387566AbeHAJ4n (ORCPT ); Wed, 1 Aug 2018 05:56:43 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 93E91C009; Wed, 1 Aug 2018 10:12:12 +0200 (CEST) Date: Wed, 1 Aug 2018 10:11:57 +0200 From: Dominique Martinet To: piaojun Cc: "akpm@linux-foundation.org" , Linux Kernel Mailing List , v9fs-developer@lists.sourceforge.net, Greg Kurz Subject: Re: [PATCH] net/9p/trans_virtio.c: add a terminal char for mount tag Message-ID: <20180801081157.GA20127@nautica> References: <5B6164F6.60004@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5B6164F6.60004@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org piaojun wrote on Wed, Aug 01, 2018: > chan->tag has no terminal char at last which will result in printing messy > code when debugging code. So we should add '\0' for tag. 9p is full of non null-terminated string so I'm not sure how I feel about it, is there anything wrong with how this is used or was this just when you tried to printf it? If it's just for debugging I'd suggest using the printf format "%.*s" with "chan->tag_len, chan->tag" arguments, That said it's not like this is costly, so I'll take it if someone else thinks this is helpful > > Signed-off-by: Jun Piao > --- > net/9p/trans_virtio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c > index d422bfc..49d71d6 100644 > --- a/net/9p/trans_virtio.c > +++ b/net/9p/trans_virtio.c > @@ -585,7 +585,7 @@ static int p9_virtio_probe(struct virtio_device *vdev) > err = -EINVAL; > goto out_free_vq; > } > - tag = kmalloc(tag_len, GFP_KERNEL); > + tag = kzalloc(tag_len + 1, GFP_KERNEL); > if (!tag) { > err = -ENOMEM; > goto out_free_vq; > -- -- Dominique