Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2399470lqp; Sun, 24 Mar 2024 17:51:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWj3r4McVIkGRqoh9hT+dwHSWEGRkeZ4kGi1ICFSfV1uHqwg41drxbPsrwn4m626Wbj08valR6hDNNy/TGTbEXvYkkO/o6TfWmb9wMIeQ== X-Google-Smtp-Source: AGHT+IEjvynK2a8ogMsH9sL5EfVmK8Ln/vv3px9uaFsUXo3PzIshJZDwJntzgF7rgVYJwM80F12s X-Received: by 2002:a05:6a20:47da:b0:1a3:616d:5744 with SMTP id ey26-20020a056a2047da00b001a3616d5744mr5720149pzb.58.1711327882552; Sun, 24 Mar 2024 17:51:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711327882; cv=pass; d=google.com; s=arc-20160816; b=nloO3qfc+8K2YiFQ7ATpmaSI0QI20u7ut10pIbNEDBGE2mIhUpR7UXwPdUbOL35oSh Lxo4VnPFUhnw0LbvN0AHxvH267jkhUy2IrJSZzq1KsBXBzRUC5jAD7z5uvGU+epxNCDA HXod2jA//KBF4oE1RO49SjVpvG0Q12VwVNAYKrX1a4EPIBnUxMV3LJwcB8fSA2E1XN0c Cd0I44bCV/WVN9Hwfld4GRgOZcqe4Gpnx4PLXrsM9gDRQpvtzF/DUb9ak721TgWMVW1f widi0xPlEFMgciokhWw24LuyKYssraLRpqMdYhNnff1Z0aE6oFwPqskhVV33SH91I4sV e41w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BbHRBCiA8ESBdhgkgpyjQCesyZkkIUgFfGtb9CptqoE=; fh=mbIwtP6Z3WHtZxItIYvYhMbpONl+h48vFqSOX4Eg0x8=; b=QSpi6DHTH5II4sQwQ6r6NEiVFj53ULMQDR3Rkfa46vYQFpvJLGk+WoMxi4QqehCt1v f7VVHs3S4MyHtNLvp3k99Q4d7LiEWXKoGshrmaWJHnDfUFz4hozPltUKxlszeeB6zDcy TFcOHFmAauEIozr+qipMdli9nrufeS/2pCr/I4xzrAwXKFRhdqZ/U5U9YR//RquNwlkV hc1/2wNyZ3wq7SgiWZltNNEKDbXrhPFZlqVijPe66OBnmYx1gw2fvP9brPig1Hru84Vj 4wXt+GWU5pJ16r3gAJ4oqALjpGsL8b9zjAMzmHfm2sChc5QVSBPCrArIVft3PpLMDUfX Gi0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q3FVCFEG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b5-20020a170902d30500b001dddbe5ab7csi3995503plc.640.2024.03.24.17.51.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:51:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q3FVCFEG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A03C92843FC for ; Mon, 25 Mar 2024 00:48:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C7741B675C; Sun, 24 Mar 2024 22:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q3FVCFEG" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A29E13CF8C; Sun, 24 Mar 2024 22:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320284; cv=none; b=ZZa1NSjRi0oNdSolYymclITkU/A0VmBqgZ7Iol3rksfHim+s4cF2XyHUiKDowN0go1MbI/s/+RL2fi5urT8LHIfH+7bN6KGhQrDokefEFvdJP/BDRl9xvXy//yHYq0Cyl+yfPieOB6foUnj+DYUns2419iFfBArBnBnADyiIIVg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320284; c=relaxed/simple; bh=Zkv4uBQK8eMbRPj/TMoLQKTy5qtiJb0tBI+C77mgZrw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EMGPs/zuWef6vt6cz724nY63Q3aYHqJsv7H8LJLmcwSNnqDtdl4Dt9PRMY+IgEOu++KFX82pSqTkcnUeZ0M79wSkLjtLhzFlZHvLw65srK64nLX8qbbiF926g6CUKMAQJNFCkbaY23cn1cIj+oHiQwzV4oRY/gCrDlvYetmi7Po= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q3FVCFEG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86BA6C433C7; Sun, 24 Mar 2024 22:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320284; bh=Zkv4uBQK8eMbRPj/TMoLQKTy5qtiJb0tBI+C77mgZrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3FVCFEGOmC9APnRXtcPcGR3c5Vzvt9h/slUECQuxhoQQ9itkHtvVxBMQf4J4VXkA PL68gGgdURg5YESjNQ/VonKSOL+/VohLpyeqo2uMzc5W2gMG/rRNojPb7/9mzzRIVU qfln6IAoHrKNmGZuILD4tXFI8dVxcyVeUAPlBVpTcXGuve2oVt6PgbrFFIIpsS+A63 DgEzIITkhSmsrahLxhM/beGSXXzewH5iHxk3xzCrCw8hZCUdYmX+ITvhK/fPnVJOsa y99afm/wdnDugDDPI3YESaF2cb+nq4fUODQIuNIbdAJIRZ/JTTIG7Jh9LsUhGsxEE6 OS8FdjjeI/bFw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Benjamin Coddington , Trond Myklebust , Sasha Levin Subject: [PATCH 6.8 592/715] NFS: Fix an off by one in root_nfs_cat() Date: Sun, 24 Mar 2024 18:32:51 -0400 Message-ID: <20240324223455.1342824-593-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Christophe JAILLET [ Upstream commit 698ad1a538da0b6bf969cfee630b4e3a026afb87 ] The intent is to check if 'dest' is truncated or not. So, >= should be used instead of >, because strlcat() returns the length of 'dest' and 'src' excluding the trailing NULL. Fixes: 56463e50d1fc ("NFS: Use super.c for NFSROOT mount option parsing") Signed-off-by: Christophe JAILLET Reviewed-by: Benjamin Coddington Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/nfsroot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c index 7600100ba26f0..432612d224374 100644 --- a/fs/nfs/nfsroot.c +++ b/fs/nfs/nfsroot.c @@ -175,10 +175,10 @@ static int __init root_nfs_cat(char *dest, const char *src, size_t len = strlen(dest); if (len && dest[len - 1] != ',') - if (strlcat(dest, ",", destlen) > destlen) + if (strlcat(dest, ",", destlen) >= destlen) return -1; - if (strlcat(dest, src, destlen) > destlen) + if (strlcat(dest, src, destlen) >= destlen) return -1; return 0; } -- 2.43.0