Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2649431imj; Mon, 11 Feb 2019 06:27:47 -0800 (PST) X-Google-Smtp-Source: AHgI3IZkBBqNdocoLyHcqyqgsgqtOlNNF4E/hnPZ3xcv71utHFc3sQa6HlC808xCdi13qvG0ygd1 X-Received: by 2002:a62:8a08:: with SMTP id y8mr5300891pfd.246.1549895267310; Mon, 11 Feb 2019 06:27:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895267; cv=none; d=google.com; s=arc-20160816; b=DGdf7mJEJodbwtE5dhOXwHZMbJXyKdgdoaX2FaLLeVDhIkjNkivUdc2aF0KjyI3I17 TojgUdHTwPPmAaTK77l9cqTpI9yQV3EVmk8zQ76uUH4Xsz9CaOp9K1apL+FS1Ti/sdss t6gouK99EsQ/3+UDY+Hpcxh98i3RHc1hizajqsaOSZBUzz0aZlungzgyiS04IBWuXjCY Kl722p3TO64nDqbqgg9mjxhe6LOHXf06O47vZvtl6yzLM3bjOQQEB/X/pLEpx4MGLNEh KG1RiIeGGyWQDkWFTNFitS3dvx9VMecOAxsY/q1xAUErXb67Eg76PQqOtEA9jFQEm8sU GArA== 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=BfEh8+mrucrcVVvVLICVknmQ6/Lz8Wa3VLfvRMf3uNw=; b=vURI8dujOuXdqnXkrxc8veIg/Bc5QymVKr7X/XLH7y+hJQ41c18f1IQWDbaRISVv/K MqoIRxroIIihzEt1NoFMEIoxsVH6e1qAY9LcqIeGHyPtOQ/PfO8kGa1bkfRBVnx95b9j VDxdSKqvdK+b1gi6fn+JnxaC5P9tkCXz2oMSeayjonn5VOJHsUYaNDSqBc0VMzCsV55M XTsAa1XdINNUaqwzMiNhb/0Qj7ITc9tvvG+gcClsrWtVCWpEj5+eA33707v/SGs5tzBX Iod3EUSE7IUflSL86ib7VXOsnfLEdP6g5I7+uN3zfpluWgYKRMkaimQuwq3lYEQ0XhIz g9pw== 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 b1si5738141pgw.288.2019.02.11.06.27.30; Mon, 11 Feb 2019 06:27:47 -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 S1729177AbfBKOYZ (ORCPT + 99 others); Mon, 11 Feb 2019 09:24:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:57540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728097AbfBKOYU (ORCPT ); Mon, 11 Feb 2019 09:24:20 -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 4737120844; Mon, 11 Feb 2019 14:24:19 +0000 (UTC) Date: Mon, 11 Feb 2019 09:24:17 -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 v2] i2c: core-smbus: don't trace smbus_reply data on errors Message-ID: <20190211092417.7f211ee0@gandalf.local.home> In-Reply-To: <20190211034021.242932-1-jsperbeck@google.com> References: <20190205190849.GA2686@kunai> <20190211034021.242932-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: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 10 Feb 2019 19:40:21 -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. This looks fine to me, but I'm not sure how the i2c maintainers feel, but I always require that a new patch version starts a new thread, and not be part of a older thread release (causes these patches to be hidden from those that read patches in threading mode). -- 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 )