Message ID | 168878452101.2721251.10090404317111770311.stgit@mhiramat.roam.corp.google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3667765vqx; Fri, 7 Jul 2023 19:50:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlEVdnIKxtBD8DCX0BQaTT1BBg23Hy4mWe/9FV3bRJlpiLeLhBUe7W3B0ltFDj0CKxmstBEw X-Received: by 2002:a05:6808:1784:b0:3a3:e7fd:a964 with SMTP id bg4-20020a056808178400b003a3e7fda964mr5187782oib.43.1688784631066; Fri, 07 Jul 2023 19:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688784631; cv=none; d=google.com; s=arc-20160816; b=jeyTMg+AbAueRZHYvmlKOmbLerwhSavjQIJr1gZ6JOQTL/ObWhzcZrf4kTb7c9U+aF 26AaSUWDalHplYKBz28R4dHfsWhyPf2hCZEnC14Hz7ijIKptai6AeMGOW80UkydKBhYs FsGH7QfympspEuKKmfBwTnEHin5GPXYUA8E3u5Uj+QN7b4et15lcuC9JeWVlCJ32Peun ZNZ2bGYGpk8imAzWCkY6Yn3+5PZiVpqxIglaPZp1b1rLU+4KAzU4gmd7M9xbu8MRfBVV kPkp0hu0utIyxVOE8DFwZOhBWbpRqT0ntRVAyDIrAMdn8yosRPa+oJPhJUoHV9XdSWdS Fm7Q== 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=sxIQGyI3tMazojJNFIxSWRn1VdVpnCyCuMxtm4X9PKY=; fh=hf24JvveL55vCfzfv0agRHDWsuhzZqIeZ7dfs5kcUjQ=; b=IF1DF0Bou+Ztzvysmz2v9d94B4OhzuE5mmp7kemVt/liNGwC86MngRVElpjocRjhBr IHxzYz/YYAb+wdUlrSOnhYHmS18fcGiqkNAQxnhjaxiu0sI9qCNEw+fkyaJHTAanaFB9 eWbqr1i+CmmjDBtgZh4YS2J1z0hAlfk6YSC8meMRLnPfbe/K5EkrpFsw6nk2huxXbtmi 832pJ4PVXWLs5Taqam7f6Rmwa2iT6brqMrVEn68i3oWM1SHkdGxuRnT0JP/+TAm3IAH9 4+46pnkAegucS4V2B3hsO84NH8EqEaf0/a3hGj7OvMNzITlJFlZi62xT6BEfjL1L+Rck IztQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DSM9l8EF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ce20-20020a17090aff1400b00262de4b0d87si3226878pjb.16.2023.07.07.19.50.18; Fri, 07 Jul 2023 19:50:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DSM9l8EF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232915AbjGHCtC (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Fri, 7 Jul 2023 22:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232909AbjGHCsv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 7 Jul 2023 22:48:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 941D526A1; Fri, 7 Jul 2023 19:48:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 33FB161A18; Sat, 8 Jul 2023 02:48:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6EA3C433C8; Sat, 8 Jul 2023 02:48:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688784525; bh=AdroxX5P9OziwCjJV/WVhJbrj4bvgg6m7fGwBk22czA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DSM9l8EFM7HHYFFC8QWSK5rY0UxRJtMfP6c1GyRdfeprm+8X73RbWZQSpgTyOI+K5 VY4lXrL5xkZ0MKwiatdTYGT7EHQkbrv4TPQ/TiZvYhhAjEMA3rNIdLP+o0GhrCKD53 o2C7o7v4hLYSyiXSLP7atrFBmuztri7DsIhbkpenOa6SgbtRF0LOorxWgTDXkT9bpV nsCe4tdZKKY5b6/WYfZMHBUObdkDjk3mt7dOr2l9EeGtVQc3ruAVMjXJok4qDiUfEl eGH3pro7Ru3H/JX24cxhUJqhhSpwosBTdnYoQYbyBOLYpmXt++xczD3ulOOHOfWB2v fC1Shf1u3eN4A== From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> To: Steven Rostedt <rostedt@goodmis.org> Cc: Dan Carpenter <dan.carpenter@linaro.org>, linux-trace-kernel@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>, Masami Hiramatsu <mhiramat@kernel.org> Subject: [PATCH v3 2/4] tracing/probes: Fix not to count error code to total length Date: Sat, 8 Jul 2023 11:48:41 +0900 Message-ID: <168878452101.2721251.10090404317111770311.stgit@mhiramat.roam.corp.google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog In-Reply-To: <168878450334.2721251.3030778817503575503.stgit@mhiramat.roam.corp.google.com> References: <168878450334.2721251.3030778817503575503.stgit@mhiramat.roam.corp.google.com> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770819033240093098?= X-GMAIL-MSGID: =?utf-8?q?1770819033240093098?= |
Series |
tracing/probes: Fix bugs in process_fetch_insn
|
|
Commit Message
Masami Hiramatsu (Google)
July 8, 2023, 2:48 a.m. UTC
From: Masami Hiramatsu (Google) <mhiramat@kernel.org> Fix not to count the error code (which is minus value) to the total used length of array, because it can mess up the return code of process_fetch_insn_bottom(). Also clear the 'ret' value because it will be used for calculating next data_loc entry. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/all/8819b154-2ba1-43c3-98a2-cbde20892023@moroto.mountain/ Fixes: 9b960a38835f ("tracing: probeevent: Unify fetch_insn processing common part") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- Changes in v2: - Check and clear ret only for the array argument. --- kernel/trace/trace_probe_tmpl.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h index 4735c5cb76fa..ed9d57c6b041 100644 --- a/kernel/trace/trace_probe_tmpl.h +++ b/kernel/trace/trace_probe_tmpl.h @@ -204,6 +204,8 @@ process_fetch_insn_bottom(struct fetch_insn *code, unsigned long val, array: /* the last stage: Loop on array */ if (code->op == FETCH_OP_LP_ARRAY) { + if (ret < 0) + ret = 0; total += ret; if (++i < code->param) { code = s3;