Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9118020pxu; Mon, 28 Dec 2020 07:05:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQzHeRn3h8FZMj7D4MAw6jRN6pRx27vW4DpaZw4ZYJN09CQlosQ4GnC4uqJiYL1geTJTIe X-Received: by 2002:a17:906:350b:: with SMTP id r11mr43421008eja.143.1609167938745; Mon, 28 Dec 2020 07:05:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167938; cv=none; d=google.com; s=arc-20160816; b=lD7mQN2QjnbtNGlT2cw5PEYGfIX/H3vc1M/Lvq23/Xl7MMGM85GqdDkyO5mzkUp1NH GPTzgP9OtFrgb2y51Seoebj9QhluyLNHHezrVNF6ZojHPs1rF19zd+INpedb9ZDcqweY L6XUphewmgxLdrBHbJUWsXQg23TQs2bC2XXo70JdNKOU88jGnRpln9KRy60+ta9v7/JU mjAjv4LtOiJm6IvSq/jDzngXNNkjwh3aQ5GSIcd483EwJYmfWe7RqNIc9cpU9xHnABUT DRvzGiT0tcIiJzQZveQ7743u9ERDdYZ/IaeosX5TwdFCiaP62MFbXV5uzx8hWB31k1TC uK3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M9BYhQFkCGjoc9XXqoNpJYleCi3qtur/hzEZl+A/ZOE=; b=XyxqACiwk2Vva80fyM2XJfbJghrZHs0ZjV3rEF+/52AW4RDzA86NzmZA/I7dZfTYDv WXklm5XyfJ5NWeulNK6piP9+lQzhm4l2CXpElLBFDqlSV0t4wLVIcqDa/TpYu4YMuyhE 1U0uBydEu6d2zyYa+XHBCWTvwILMN07YFuR4byxmqZS6sKxhwfWAm2HTarMgLtlM8sPW LC/GBmJJA/ak7ao7g1uZNtP6B0yzDIqh1q+K50nElZAJbA695vkN7ayOo41FZyxl2O03 /PamAJwv5KbtrHWmC863rrPA1OnZYnEGpEu82O59FxxAGVVCSNWKwfnEllm8yYGAd+Jk DhBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ajo1FsWH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si20560455eda.189.2020.12.28.07.05.16; Mon, 28 Dec 2020 07:05:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ajo1FsWH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439396AbgL1PDd (ORCPT + 99 others); Mon, 28 Dec 2020 10:03:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:47222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439884AbgL1OMb (ORCPT ); Mon, 28 Dec 2020 09:12:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 689AE205CB; Mon, 28 Dec 2020 14:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164710; bh=VzmwSly9OGY6Tl/9K8gxHqG98NunnJFINc05TrFHU+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ajo1FsWHz6LBAGFXxh7RBIN20WpgYgIkRwv9/4wDXTq3gZgO2XP7riej0F0fitt9x zmuqfyAyoglL6dpBfs/MDuxa01ag7ciJ2QAOLcjuXlexlEizMNlk9NjW1OHd9ACA2i Z08hQrQ5KHyhGQ8QRYQLZ7ODTsiToEDKTo97wSpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fedor Tokarev , Trond Myklebust , Sasha Levin Subject: [PATCH 5.10 270/717] net: sunrpc: Fix snprintf return value check in do_xprt_debugfs Date: Mon, 28 Dec 2020 13:44:28 +0100 Message-Id: <20201228125033.950359662@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fedor Tokarev [ Upstream commit 35a6d396721e28ba161595b0fc9e8896c00399bb ] 'snprintf' returns the number of characters which would have been written if enough space had been available, excluding the terminating null byte. Thus, the return value of 'sizeof(buf)' means that the last character has been dropped. Signed-off-by: Fedor Tokarev Fixes: 2f34b8bfae19 ("SUNRPC: add links for all client xprts to debugfs") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- net/sunrpc/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c index fd9bca2427242..56029e3af6ff0 100644 --- a/net/sunrpc/debugfs.c +++ b/net/sunrpc/debugfs.c @@ -128,13 +128,13 @@ static int do_xprt_debugfs(struct rpc_clnt *clnt, struct rpc_xprt *xprt, void *n return 0; len = snprintf(name, sizeof(name), "../../rpc_xprt/%s", xprt->debugfs->d_name.name); - if (len > sizeof(name)) + if (len >= sizeof(name)) return -1; if (*nump == 0) strcpy(link, "xprt"); else { len = snprintf(link, sizeof(link), "xprt%d", *nump); - if (len > sizeof(link)) + if (len >= sizeof(link)) return -1; } debugfs_create_symlink(link, clnt->cl_debugfs, name); -- 2.27.0