From patchwork Tue Jun 23 19:57:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223256 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 816C2C433E0 for ; Tue, 23 Jun 2020 21:11:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 557D82072E for ; Tue, 23 Jun 2020 21:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592946710; bh=hG/hd2J4dHLGSRu02sYKuZfaGjpfA6fauxrCVBm5Y5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Qv1S4uvDvcGAhgu9v+SAwlcuy1xsVKvrXG2DJvxjcp57ITL9e7zvdM9kVVMmeIITw 5SpTn01GDPNZJSIrawrR04awRxYIex/YbXenJG/f0CI22hArqyYZI5tipO6XFJnOV0 s+E30CPZ10qORdo1BAeWCVQpPSQiGAWVSXhfpuUs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391281AbgFWVLp (ORCPT ); Tue, 23 Jun 2020 17:11:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:52962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390824AbgFWUcK (ORCPT ); Tue, 23 Jun 2020 16:32:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C7CCF206C3; Tue, 23 Jun 2020 20:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944330; bh=hG/hd2J4dHLGSRu02sYKuZfaGjpfA6fauxrCVBm5Y5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sg0gbTOrvmDcC1wC1mhzuxXyX/+TrxBMIlblXnR5xKnMTJ4LYAuqACPbejjhY4GKj siNU4SAM0piHD3FOGyuj051ACCZPiN9u9qvvk/Lxpc9bVRPd9sfE3ffNJcXEG6PgJK wXi9aNIAMmJjVQNsMeAsjtvxfDxJawBFSCYDgigw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Allen Hubbe , Alexander Fomichev , Jon Mason , Sasha Levin Subject: [PATCH 5.4 232/314] NTB: ntb_tool: reading the link file should not end in a NULL byte Date: Tue, 23 Jun 2020 21:57:07 +0200 Message-Id: <20200623195350.019416168@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Logan Gunthorpe [ Upstream commit 912e12813dd03c602e4922fc34709ec4d4380cf0 ] When running ntb_test this warning is issued: ./ntb_test.sh: line 200: warning: command substitution: ignored null byte in input 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 Acked-by: Allen Hubbe Tested-by: Alexander Fomichev Signed-off-by: Jon Mason Signed-off-by: Sasha Levin --- 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 025747c1568ea..311d6ab8d0160 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); -