Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1195152imm; Fri, 15 Jun 2018 12:48:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIqgsmArmhYURzKRDmdhkA9hBuW+CAe+6SYrcDBjVd4rmktX7Sh5m2TR00t753KNP9FnJqf X-Received: by 2002:a63:9a52:: with SMTP id e18-v6mr2819554pgo.188.1529092111852; Fri, 15 Jun 2018 12:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529092111; cv=none; d=google.com; s=arc-20160816; b=sUDA7cCT0aLBkzkudeFvakS/X3tLkE+64oRpVwOqBDkf76FTr0hotY3AqTMsT3IiU2 glxQkOGnmhuxxilpzvyx52X0U2YGUAXHQjjYb7yTmOISskPEy2kPKItBvAVNK9TqRnvb c8DoprqZ6N5P7o1EY194MJc+67TNBRjsUaxN3jRLBXCpNjNiWOGp7c+d9KDnOb02qVYC CfmUuaSG9UwywCRugH2ePz/RcxGRnv+rWCXiTBA6m2Txt4od9rpKDBNKx2MG20ce+bP2 Rvc/cuieqznNBNB63a00PFijGC++MhiBNGFvbcMunG/iKBh6fBSxPgUohPG2gidnImn4 XscQ== 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:arc-authentication-results; bh=BMxlPA9uynTUmNtBWq8jEEjRdz3X01UilQjmvla4N1s=; b=Cztxna1n7pdgHqp1Zv+s6KBOL0LtgZpBrM2DsPPkIj8DLk5lBa+unIOM5+qsmePlOo hlyaVG+Jfsg3Hp9MwvfCKExM339wC5cZtuGE54npakJKZDDUHucBamVTg4Nw3Ok/ybC/ TL4dyDylqd/3G+MFKyQoBNOvjYl30WM0wBbuQJrGJth3S18htQjGJ8mYkqnnv7H2LiHA C1KREeDu/MZXVNBk4hxWwn4BABNVjIkR1tZGgjZHieLZsJQu7YS72exzUZuTJk3YxZyJ wdbKw6C0zIRn3ARnS9p/RznoVDykVnLMD7ekt6IN9fLS2uaSHs4PiqgHFTXU1W4JlEfI NxbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=leG7DScR; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5-v6si8682183pln.347.2018.06.15.12.48.17; Fri, 15 Jun 2018 12:48:31 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=leG7DScR; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966283AbeFOTrm (ORCPT + 99 others); Fri, 15 Jun 2018 15:47:42 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:41226 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966149AbeFOTrl (ORCPT ); Fri, 15 Jun 2018 15:47:41 -0400 Received: by mail-lf0-f66.google.com with SMTP id d24-v6so16232260lfa.8 for ; Fri, 15 Jun 2018 12:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=BMxlPA9uynTUmNtBWq8jEEjRdz3X01UilQjmvla4N1s=; b=leG7DScRnKzckV9j1zye2cI/Rl4B0eOZ9kE6DgrO/JtmzSnB7m0/jQa0GHLZ25/U6e mqW+RWIDQuXNMIKpGsIHhp8pEkVuDIIpWEeocpOk9hnIR+D7uukw5uyzhiB1S2fYF0xN ZBaLoJMpj1oBybyjPzZpUdiJXRLbR4zdhFVkDi20D22vtHa87A/E4C1CWCrXQM3yN4Bt Mjx0zg4fo9MOUvLIjlnJELS+WDta1U8oIJaRJ5077c9b8QWOqOhAIjHu51Wdp5xT4X7L 6ux2folNPG4oOdPknIdupUfN8Q2k6CN22ZTl+sweccVbygMgYsQ1qOnV3XrMhJOIomDD +5Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BMxlPA9uynTUmNtBWq8jEEjRdz3X01UilQjmvla4N1s=; b=p7Od3m000KARh/JxeR3/G29dkB6uptzdzRnyyPp41KUAH8pMlbIjX/asYmEZbe8adi YqZyG6Jp9EmbkXhUrU2OTVUfzlcLBdKreWXUtaOBceu1NgsDr/KdfLZojKqZ9zoDnUPQ 5o24I75HHqQybEgeaI+3SlcDmiLiUD73nB+SskGYkUVI4j+GaOg2+K9GrINkztWz7/Ez lQciWqw5SGCy9NcAXuc8Rbvu+EIhGNTV3XRaMwkHy2pjjAevo0Z8NHU0cj/6dqljAL6B koaSKGKudXwCxJpz6Ibipctf1CzZO3UDAaidgHotAobnoWyuIMwCJfpeHqW3wfEzZm/t OjzA== X-Gm-Message-State: APt69E0ULxuLpp1eJ4F9r0Kg96LMaY0PrJ+depy3kJFW7sdUS/iy6bIf 42ob5keGSXndkKS4OJXQxA8= X-Received: by 2002:a2e:60:: with SMTP id 93-v6mr2249597lja.96.1529092060182; Fri, 15 Jun 2018 12:47:40 -0700 (PDT) Received: from mobilestation ([5.166.218.73]) by smtp.gmail.com with ESMTPSA id d62-v6sm36687lfd.50.2018.06.15.12.47.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jun 2018 12:47:39 -0700 (PDT) Date: Fri, 15 Jun 2018 22:47:48 +0300 From: Serge Semin To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, Jon Mason , Dave Jiang , Allen Hubbe , Shyam Sundar S K , Shuah Khan Subject: Re: [PATCH 1/8] NTB: ntb_tool: reading the link file should not end in a NULL byte Message-ID: <20180615194748.GA15481@mobilestation> References: <20180609000819.13883-1-logang@deltatee.com> <20180609000819.13883-2-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180609000819.13883-2-logang@deltatee.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 08, 2018 at 06:08:11PM -0600, Logan Gunthorpe wrote: > When running ntb_test this warning is issued: > > ./ntb_test.sh: line 200: warning: command substitution: ignored null > byte in input > This is weird. Neither me nor the folks' who tested the script saw this warning. I tried it on my laptop with bash and on a target device with busybox-shell. The warning never occurred. I even tried a simple command like: [[ $(echo -ne "\x4e\x0a\00") == "N" ]] && echo "True" It might be that your bash is more modern than mine. Anyway if this patch solves the problem you see, that's great. Thanks for it. -Sergey > This is caused by the kernel returning one more byte than is necessary > when reading the link file. > > Reduce the number of bytes read back to 2 as it was before the > commit that regressed this. > > Fixes: 7f46c8b3a552 ("NTB: ntb_tool: Add full multi-port NTB API support") > Signed-off-by: Logan Gunthorpe > --- > drivers/ntb/test/ntb_tool.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c > index d592c0ffbd19..ec5cf095cdb9 100644 > --- a/drivers/ntb/test/ntb_tool.c > +++ b/drivers/ntb/test/ntb_tool.c > @@ -504,7 +504,7 @@ static ssize_t tool_peer_link_read(struct file *filep, char __user *ubuf, > buf[1] = '\n'; > buf[2] = '\0'; > > - return simple_read_from_buffer(ubuf, size, offp, buf, 3); > + return simple_read_from_buffer(ubuf, size, offp, buf, 2); > } > > static TOOL_FOPS_RDWR(tool_peer_link_fops, > @@ -1690,4 +1690,3 @@ static void __exit tool_exit(void) > debugfs_remove_recursive(tool_dbgfs_topdir); > } > module_exit(tool_exit); > - > -- > 2.11.0 >