Message ID | 168873726308.2687993.8028219145865540388.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 v5csp3283704vqx; Fri, 7 Jul 2023 06:52:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlGAg5T3mzJAVQPcaaA3Qex1Ft4xwskPgR6pZoxoU39lP50xG+zPHDQ4x1NYKkUoLPnr9yJu X-Received: by 2002:a05:6358:2812:b0:132:f612:1dbd with SMTP id k18-20020a056358281200b00132f6121dbdmr7263875rwb.26.1688737972413; Fri, 07 Jul 2023 06:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688737972; cv=none; d=google.com; s=arc-20160816; b=loFekpCdRfjz3XWRiUJIOv9Xfk3Iv2662yf+pwnBbIbjB+tSLtrM2astvG7ZEyP6Un tbkA7GgGQv0g+sz6YlfPN6tXF6qqNlt4QxepuAX/Ct0SKSLKTJYCwegN14wRdvmesE3e 1GP9vjVerP1PIfGoW7onerVYsEIL2UMAtM0Xp45yTAneyl4q6JEQpmB7nX895bcqygkz OpPRQuVxn5nmItdot7jTKMAuobEQ6De88P7cnnSiwJdakgSqRCAvnJJpVtdq2zuNatkl Z3nXcedMIbOO8aJ0fo5++qPPaQi8XBRbzjZllsSfDd6BZw4huR97e8A/7qm1R2ZVghvd w0QA== 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=x+Z3dwWaak+LF8Kg/2JF1k4my7SXEBOv2XkfD6wYDA7uI0vALFzW5RFDnLsOZA5BPg MMYtr85UTGDQThZULTESO/Yq02Qj01e2Cdj0QUcH7kgI7P29dBzaqOOwI/S4pB5K0AEF 3e8Et4q1grIcsChpvO/gxOY/mNkeNSsHO1MENziR6F3rvfSNbsKxz7x8cPkTtU339yBy dNSgTtzIBbqp/x9qyFc3luunce8IvnMDQki5WWBqGmDKIN79qpExOv7cvrijrIcQajbC pv7QdWkhr2gEAwV/uBpOnjRIXaA99vXDe4Mq230VAgvEzCI6gujqRa0vnVjkIyVC1erp mYSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vNSspgDG; 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 r81-20020a632b54000000b0055384329027si3914547pgr.566.2023.07.07.06.52.38; Fri, 07 Jul 2023 06:52:52 -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=vNSspgDG; 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 S232033AbjGGNlO (ORCPT <rfc822;daweilics@gmail.com> + 99 others); Fri, 7 Jul 2023 09:41:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230166AbjGGNlM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 7 Jul 2023 09:41:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CCF82685; Fri, 7 Jul 2023 06:41:07 -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 3C0F161995; Fri, 7 Jul 2023 13:41:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97443C433C8; Fri, 7 Jul 2023 13:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688737266; bh=AdroxX5P9OziwCjJV/WVhJbrj4bvgg6m7fGwBk22czA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vNSspgDGl1K7znTM5/p29Q60w1EEAvhuJxKkirUDVM5i73j453wN+0t8RfcNHlKZP dJ3fdJcuuDn07saPFmI1qu0kITZP0Rt9wdN5AqpNM7UPmClW0MkwU0obwVM7w0AC0v Pjdv/tbPczP7t9DhQKRLD9vbRF2GMWQqguUhzuJDP2eF4hncOotKb1+nVzZ45pq210 y+VlBEiE4CKbe9Vmpx3yBp84lGTX2ihO1o8fFX0SQGfsA/3whkz2dwRVrSvSgEFVO5 wIe1BiT7FdvrTQQAbmV2sOus/FKRNV3t+OznSF3TbNrjc7j5yWtpvpC3yI5IVLgazY cFnP8cEZ4vIwg== 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 v2 2/4] tracing/probes: Fix not to count error code to total length Date: Fri, 7 Jul 2023 22:41:03 +0900 Message-ID: <168873726308.2687993.8028219145865540388.stgit@mhiramat.roam.corp.google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog In-Reply-To: <168873724526.2687993.15242662075324919195.stgit@mhiramat.roam.corp.google.com> References: <168873724526.2687993.15242662075324919195.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?1770770108324565310?= X-GMAIL-MSGID: =?utf-8?q?1770770108324565310?= |
Series |
tracing/probes: Fix bugs in process_fetch_insn
|
|
Commit Message
Masami Hiramatsu (Google)
July 7, 2023, 1:41 p.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;