From mboxrd@z Thu Jan 1 00:00:00 1970 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 6D00D27F1D for ; Fri, 21 Jul 2023 18:49:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2249C433C7; Fri, 21 Jul 2023 18:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689965397; bh=KWeJ2j2Qzfczza2ZXYAH3bXOCfWctf9d36m5bYmngPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DUOddvX0xNgUHu/r9hL8ETvRPAwMHbuu6kDwelLyPpMymaDi4HHxyoAKNXUyuH7ea dCIOrqE/pQmhSrKqn3bj8fL33gdaK9KY/0vAWcmrKPmSXWysp5X34T59ZGz7SFvG4h krPmk1VQo1dSTgs9LYh0JfyuYBJKx4fYY6ePxiJk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dan Carpenter , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 6.4 269/292] tracing/probes: Fix to avoid double count of the string length on the array Date: Fri, 21 Jul 2023 18:06:18 +0200 Message-ID: <20230721160540.496453552@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721160528.800311148@linuxfoundation.org> References: <20230721160528.800311148@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Masami Hiramatsu (Google) commit 66bcf65d6cf0ca6540e2341e88ee7ef02dbdda08 upstream. If an array is specified with the ustring or symstr, the length of the strings are accumlated on both of 'ret' and 'total', which means the length is double counted. Just set the length to the 'ret' value for avoiding double counting. Link: https://lore.kernel.org/all/168908492917.123124.15076463491122036025.stgit@devnote2/ Reported-by: Dan Carpenter Closes: https://lore.kernel.org/all/8819b154-2ba1-43c3-98a2-cbde20892023@moroto.mountain/ Fixes: 88903c464321 ("tracing/probe: Add ustring type for user-space string") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu (Google) Reviewed-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_probe_tmpl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/trace/trace_probe_tmpl.h +++ b/kernel/trace/trace_probe_tmpl.h @@ -156,11 +156,11 @@ stage3: code++; goto array; case FETCH_OP_ST_USTRING: - ret += fetch_store_strlen_user(val + code->offset); + ret = fetch_store_strlen_user(val + code->offset); code++; goto array; case FETCH_OP_ST_SYMSTR: - ret += fetch_store_symstrlen(val + code->offset); + ret = fetch_store_symstrlen(val + code->offset); code++; goto array; default: