Received: by 10.213.65.68 with SMTP id h4csp3599455imn; Tue, 3 Apr 2018 07:43:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx49tERgCqWl5tMBaURt2wFgHNsSJzt0qO7i2A0Pf1yVIcdYouj9xuozuaonZRLSXkN+swRe1 X-Received: by 2002:a17:902:6acc:: with SMTP id i12-v6mr14695780plt.353.1522766609385; Tue, 03 Apr 2018 07:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522766609; cv=none; d=google.com; s=arc-20160816; b=h4I8Kb1seBlLaLVCNOhlRoGD8r7QxVlT0B5+nOKGk0X4Qb9KeqEB8Zb5lnkVs5KUIQ zz8LY0a1STDuEGwFP16Qvv+7MswWME1Q4BLS9D5citK2LcgP3bKroieDR8brHWFs5k0K JWze3bXeYWgDWArIlRhduE4GyqC5He9A7xbrJSFWEgIJ1X67hYaKv8Mt98HZuanjB3FZ UARyeGtb15TWl8Ve8T4NmYiObdMsmPVExWFrO+yt2JrSug/AgURAbqcvjmd8wsmdlTRj aMEkTeS/FiDG5bZ/Q50nFviKmqYhjhRBifMahR6dCw89Jufg6UYQO9eARhgmLPWl5oPO XrFA== 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 :dmarc-filter:arc-authentication-results; bh=KD9WPD4ngOiEzcQz3n/Iw2aP9XbxsZc6Y31akEd/BWo=; b=YJESYbKOCAsRfwTf+Q/smiZtGjMiWWJtd+wthYFNSTSlFn4YTgL4AZprxbYVMPNSAn 3n3goHXvlYJRF1MEROBUTwsvSdpjEx4iIoMKS93V7ypejVY2JRuNw0ovxDJMLcw17wPL 0ara7owt6g/3K4J6ZM5nUwCdmLjXZ+U+X3xql7M69gZjJmLwCyG8KODMsDB7ScRSLucT sgtMfjkDGhT9thN4WKXX6P+k0/IeZa1aLYogCk4nXQ0xhw6Y92KmWvX+YMojRu1yYeM0 YJUoAD/llfzzrcaqZSXunpAwR87bYT4aNXiIZGW8/aw25glMJrCOixPKDH3H9daMKVAJ S1lQ== 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 n77si2288583pfh.307.2018.04.03.07.43.15; Tue, 03 Apr 2018 07:43:29 -0700 (PDT) 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 S1751613AbeDCOl7 (ORCPT + 99 others); Tue, 3 Apr 2018 10:41:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751247AbeDCOl6 (ORCPT ); Tue, 3 Apr 2018 10:41:58 -0400 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 E29A920CAA; Tue, 3 Apr 2018 14:41:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E29A920CAA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org Date: Tue, 3 Apr 2018 23:41:53 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Namhyung Kim , Tom Zanussi , Arnaldo Carvalho de Melo , linux-trace-users@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah@kernel.org, Ravi Bangoria Subject: Re: [PATCH v6 10/21] tracing: probeevent: Return consumed bytes of dynamic area Message-Id: <20180403234153.7bd44567305ca11cead0e35b@kernel.org> In-Reply-To: <20180402160207.23c96309@gandalf.local.home> References: <152129024033.31874.15800253385376959274.stgit@devbox> <152129069244.31874.7879658400858676349.stgit@devbox> <20180402160207.23c96309@gandalf.local.home> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-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 Mon, 2 Apr 2018 16:02:07 -0400 Steven Rostedt wrote: > On Sat, 17 Mar 2018 21:44:52 +0900 > Masami Hiramatsu wrote: > > > -static nokprobe_inline void > > -fetch_store_string(unsigned long addr, void *dest) > > +static nokprobe_inline int > > +fetch_store_string(unsigned long addr, void *dest, void *base) > > { > > - int maxlen = get_rloc_len(*(u32 *)dest); > > - u8 *dst = get_rloc_data(dest); > > + int maxlen = get_loc_len(*(u32 *)dest); > > + u8 *dst = get_loc_data(dest, base); > > long ret; > > > > if (!maxlen) > > - return; > > + return -ENOMEM; > > > > /* > > * Try to get string again, since the string can be changed while > > @@ -854,19 +851,19 @@ fetch_store_string(unsigned long addr, void *dest) > > > > if (ret < 0) { /* Failed to fetch string */ > > dst[0] = '\0'; > > - *(u32 *)dest = make_data_rloc(0, get_rloc_offs(*(u32 *)dest)); > > - } else { > > - *(u32 *)dest = make_data_rloc(ret, get_rloc_offs(*(u32 *)dest)); > > + ret = 0; > > Why do you return 0 here and not the error value? You return -ENOMEM > above if maxlen is zero. Good catch! it should clear dst[0] and return 0 even if no buffer remains... OK, I'll fix it. Thank you! > > -- Steve > > > } > > + *(u32 *)dest = make_data_loc(ret, (void *)dst - base); > > + return ret; > > } -- Masami Hiramatsu