Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp4966881ima; Tue, 5 Feb 2019 04:26:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IbAvvZ/ljzeFnw/2yQcCmailO5GuWH35IV6f9KkjzUW4+/ZzieKOi5upgBxBd80h2y7Tx1N X-Received: by 2002:a62:1212:: with SMTP id a18mr4874328pfj.217.1549369603289; Tue, 05 Feb 2019 04:26:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549369603; cv=none; d=google.com; s=arc-20160816; b=Qvl6ZM7+HYIkhMTm8I//kmM+46On32e8dOzNtyubNRwY6fV/oh28CNecgC7bNy2jpv ioQfQ6umZmAnzpoT6lWiM0RDFs10/8zfGQXEQC4pJ9SE2BewbkKYxZhbOcBcHc2rYuho zgwKFTQI+KRss6dQa+PrJzJ8/hyGqMCQPWCcCm50wMhUdeq0xGnqWP9u4J32uErXA1En thIbUc/GQ2CMTf1D6oXQNxoB4t1jkESdpUtLdUkBLobELV1+QoEH+PhE7QBm/TVAkA/J 45gvBG5Imk5r2FDkLs8NUmYBgaC4ZXvvT+xarKMyUlAYPfW5z+9BrwSqoNlK3pQq4iJo X17w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=x/eN5erAxf30qhtxYzkp5xgUYgU24zHAfnlPxSs27YA=; b=NY/8Dg+ntYIAqSCcBzuH8BzRUYbAnJVylFeJ0ugM0bH7JPwkG2jqiNWJW6phDu2dMt LYqqMGOS886eKolTjRmgasvUfy561+O9UMSLBRZI8Erye2SKHRgBIwmRbO2lz4BeR7rc 7jChgMy+fQUOqqgcQgbnsY8659cZKcP8NDhgCGSRGnpDde3oT1MIGUZe9Iu73uMsyAtC 0YrSU3yU8b70WjFr28hFgMVoWRm2T+VoJsCBgf3oQCjjcosDxG6mRtGRnas9N2JH5RrQ xh6i+oizNagdng1T1xBUjGDsrqCJrx9nPDyZb2nEHQ2BfEkpdQDIGQmrX70OXVudJh/6 EbAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 82si3295898pfa.115.2019.02.05.04.26.27; Tue, 05 Feb 2019 04:26:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728628AbfBEMOU (ORCPT + 99 others); Tue, 5 Feb 2019 07:14:20 -0500 Received: from sauhun.de ([88.99.104.3]:56804 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726065AbfBEMOT (ORCPT ); Tue, 5 Feb 2019 07:14:19 -0500 Received: from localhost (unknown [46.183.103.8]) by pokefinder.org (Postfix) with ESMTPSA id BB53E4A16DD; Tue, 5 Feb 2019 13:14:07 +0100 (CET) Date: Tue, 5 Feb 2019 13:13:57 +0100 From: Wolfram Sang To: Steven Rostedt Cc: John Sperbeck , Ingo Molnar , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: core-smbus: don't trace smbus_reply data on errors Message-ID: <20190205121353.GC1045@kunai> References: <20190104004203.116155-1-jsperbeck@google.com> <20190103214927.2bf947ca@vmware.local.home> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="lCAWRPmW1mITcIfM" Content-Disposition: inline In-Reply-To: <20190103214927.2bf947ca@vmware.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --lCAWRPmW1mITcIfM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 03, 2019 at 09:49:27PM -0500, Steven Rostedt wrote: > On Thu, 3 Jan 2019 16:42:03 -0800 > John Sperbeck wrote: >=20 > > If an smbus transfer fails, there's no guarantee that the output > > buffer was written. So, avoid copying from the output buffer when > > tracing after an error. This was 'mostly harmless', but would trip > > up kasan checking if left-over cruft in byte 0 is a large length, > > causing us to read from unwritten memory. > >=20 > > Signed-off-by: John Sperbeck > > --- > > drivers/i2c/i2c-core-smbus.c | 2 +- > > include/trace/events/smbus.h | 10 +++++----- > > 2 files changed, 6 insertions(+), 6 deletions(-) > >=20 > > diff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c > > index 9cd66cabb84f..132119112596 100644 > > --- a/drivers/i2c/i2c-core-smbus.c > > +++ b/drivers/i2c/i2c-core-smbus.c > > @@ -585,7 +585,7 @@ s32 __i2c_smbus_xfer(struct i2c_adapter *adapter, u= 16 addr, > > trace: > > /* If enabled, the reply tracepoint is conditional on read_write. */ > > trace_smbus_reply(adapter, addr, flags, read_write, > > - command, protocol, data); > > + command, protocol, data, res); > > trace_smbus_result(adapter, addr, flags, read_write, > > command, protocol, res); > > =20 > > diff --git a/include/trace/events/smbus.h b/include/trace/events/smbus.h > > index d2fb6e1d3e10..b6376a7c7e74 100644 > > --- a/include/trace/events/smbus.h > > +++ b/include/trace/events/smbus.h > > @@ -138,8 +138,8 @@ TRACE_EVENT_CONDITION(smbus_reply, > > TP_PROTO(const struct i2c_adapter *adap, > > u16 addr, unsigned short flags, > > char read_write, u8 command, int protocol, > > - const union i2c_smbus_data *data), > > - TP_ARGS(adap, addr, flags, read_write, command, protocol, data), > > + const union i2c_smbus_data *data, int res), > > + TP_ARGS(adap, addr, flags, read_write, command, protocol, data, res), > > TP_CONDITION(read_write =3D=3D I2C_SMBUS_READ), >=20 > Hmm, instead of tracing nothing, as this is already a "conditional > trace event", why not add to that condition: >=20 > TP_CONDITION(res >=3D 0 && read_write =3D=3D I2C_SMBUS_READ), >=20 > Unless you want to still trace some data on failure. John, any comment to this? --lCAWRPmW1mITcIfM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlxZfgEACgkQFA3kzBSg Kbb8Ng//bM9+CBUDuxVV1jEQm1tBwiH1+JclMxzabWd/btO/fwW8h4DQv25NEKI2 irYP2G0KSzUugfBnnJ0011e+CLOAaB/Txh9Ju/oXDwNX6wZqUeS9V6Hp9DI6oSR0 fogaBeZKvLvfyrYEt9XVNUPHRVyMHUoMUo8VRFaNaZX02bx9+RsgmXOV9yX2STAT E1dZ9d7v74i3Fhrr2yrCTd7QpeT7ohNXJLalW68ZY/LgGG7rBTusRgAvPL1T/x4d ifM4D/WBiw7JymainbUdm6SNpIGQkQ7qlD0uAJv+uUqUhU75s7tO1lcExtC049TN MYHSMhycgk5338s/4Sp4izgh/2hl+HNdNgd5Mtwgw7M97N2Erm6FGMJLmpb9jZ0q NalbqbxThIYBSGMTNxwHKGl20aUce2+uT9cNsaDjhpQav0IeGVDcj93dIMb+SFsn AP6raxAhRgZM6Da5PhNtaetfULUF/wYnG+B+So5/TRCeMauhKGUn4qkFjGERyHIQ JjSoeJPqeTbe0+zqWmpiKu11ldQeIuzd0L9K+696AiV5zRz64dw3TTBl9ayZiP3n 9bl9uPbwTP+SwyytzHNgx2Fi9qLMorQqzArMK1kC24Pjvx3tIDGcCn5i3lmMcUaj HtO1uOL0gSdgjVf8qP4O33RVrGuwIEfvP8gV2P/fhSSK2399aHA= =GMyX -----END PGP SIGNATURE----- --lCAWRPmW1mITcIfM--