linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: John Sperbeck <jsperbeck@google.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: core-smbus: don't trace smbus_reply data on errors
Date: Tue, 5 Feb 2019 13:13:57 +0100	[thread overview]
Message-ID: <20190205121353.GC1045@kunai> (raw)
In-Reply-To: <20190103214927.2bf947ca@vmware.local.home>

[-- Attachment #1: Type: text/plain, Size: 2312 bytes --]

On Thu, Jan 03, 2019 at 09:49:27PM -0500, Steven Rostedt wrote:
> On Thu,  3 Jan 2019 16:42:03 -0800
> John Sperbeck <jsperbeck@google.com> wrote:
> 
> > 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.
> > 
> > Signed-off-by: John Sperbeck <jsperbeck@google.com>
> > ---
> >  drivers/i2c/i2c-core-smbus.c |  2 +-
> >  include/trace/events/smbus.h | 10 +++++-----
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > 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, u16 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);
> >  
> > 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 == I2C_SMBUS_READ),
> 
> Hmm, instead of tracing nothing, as this is already a "conditional
> trace event", why not add to that condition:
> 
> 	TP_CONDITION(res >= 0 && read_write == I2C_SMBUS_READ),
> 
> Unless you want to still trace some data on failure.

John, any comment to this?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-02-05 12:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-04  0:42 [PATCH] i2c: core-smbus: don't trace smbus_reply data on errors John Sperbeck
2019-01-04  2:49 ` Steven Rostedt
2019-02-05 12:13   ` Wolfram Sang [this message]
2019-02-05 17:19     ` John Sperbeck
2019-02-05 19:08       ` Wolfram Sang
2019-02-11  3:40         ` [PATCH v2] " John Sperbeck
2019-02-11 14:24           ` Steven Rostedt
2019-02-11 21:43             ` John Sperbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190205121353.GC1045@kunai \
    --to=wsa@the-dreams.de \
    --cc=jsperbeck@google.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).