Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp210121imj; Wed, 13 Feb 2019 07:07:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IYDH0IW2xQT4bUy7iTIl1+7qCa7Hw1XEV2Z3wCjq31cxCnGJSrIYv6/3+77yka2+Vplgk5Z X-Received: by 2002:a63:481f:: with SMTP id v31mr878307pga.29.1550070463228; Wed, 13 Feb 2019 07:07:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550070463; cv=none; d=google.com; s=arc-20160816; b=nR9WoMvSZEzNxrAwrkXtfEzOl8cg5gIayC2lYh1oV+D3SuYlgUwFC0hVLsCc2YOY2Y VNJkiQg5IbqB8eg6k4F79WinHHdHoQfxIcHEcM/lxJHiXsLcsZxpCXhuddjwqW4qjOhZ WouFthZqGpCbUEMMDecSfQNmdIjKxHxIRV2jWDxkYT8Q5f0pUYmd5Ez+O0NNKl8RjTls 1BKjfuuLwl1/EkhXNMoH9dBdaw5Xcr/JXiTalFzTVHVrNsVAw4zppmA/VbyprdSjMIsn LzYvCx3SFj4ZHioAnI42iY+jU3iRAO6hrrhKpk73G+txnmppkRaxGqcqUwQ7GvnlqHHT 1f3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=m99iHurW6M3FP4JJLfV3Vg5exy5q4ceyDjSvqChNmCA=; b=haEmserYjegO9cpRc4+LWAnHWNzV8TZAEoww0+YZABta9Bjz8Fg0QjrLf5lNRtAf7W QuYmkomSqM7pcv1p8581B4y1eTRYoWmCpwR+uQbT4P48vqwzu0MxaIQxZLRqkjW6iq2P Osgpixvq0baFkk/mXwcnsKl64Zd7yktCdzpgWYFqS9zZ2MMp7OVoWe3uKqwCbGJFcO0k sDDI+bLXeCuq4AbhfkWL0dBROLV6JfG4nQ+lpzyjQtxABs99569DSCKYw7TiU5t3sIga 4ayxHcQwFXr9UC63vhjSFwYXGUTuR/WFA4hgVF6Vu4Sc18V0yQCcotdHyq5wd5agqpoF HG3g== 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 h36si4919559pgm.200.2019.02.13.07.07.26; Wed, 13 Feb 2019 07:07: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 S1732066AbfBMNu5 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 13 Feb 2019 08:50:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:32782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727894AbfBMNu5 (ORCPT ); Wed, 13 Feb 2019 08:50:57 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E4B8A2075D; Wed, 13 Feb 2019 13:50:55 +0000 (UTC) Date: Wed, 13 Feb 2019 08:50:54 -0500 From: Steven Rostedt To: John Sperbeck Cc: wsa@the-dreams.de, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com Subject: Re: [PATCH v3] i2c: core-smbus: don't trace smbus_reply data on errors Message-ID: <20190213085054.1a63c95a@gandalf.local.home> In-Reply-To: <20190213034057.244716-1-jsperbeck@google.com> References: <20190213034057.244716-1-jsperbeck@google.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Feb 2019 19:40:57 -0800 John Sperbeck wrote: > If an smbus transfer fails, there's no guarantee that the output > buffer was written. So, avoid trying to show 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. From a tracing viewpoint: Reviewed-by: Steven Rostedt (VMware) -- Steve > > Signed-off-by: John Sperbeck > --- > drivers/i2c/i2c-core-smbus.c | 2 +- > include/trace/events/smbus.h | 6 +++--- > 2 files changed, 4 insertions(+), 4 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..a4892a187842 100644 > --- a/include/trace/events/smbus.h > +++ b/include/trace/events/smbus.h > @@ -138,9 +138,9 @@ 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), > - TP_CONDITION(read_write == I2C_SMBUS_READ), > + const union i2c_smbus_data *data, int res), > + TP_ARGS(adap, addr, flags, read_write, command, protocol, data, res), > + TP_CONDITION(res >= 0 && read_write == I2C_SMBUS_READ), > TP_STRUCT__entry( > __field(int, adapter_nr ) > __field(__u16, addr )