Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp736135rwb; Wed, 26 Jul 2023 01:51:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlHFtM5XeWZ5/RKLXDM81TRYIJQ2EUitadr1E3U40fkHzrNW7JLDlz1i5j9Zb8nji/la0wlU X-Received: by 2002:a05:6e02:13c7:b0:348:9fb8:abea with SMTP id v7-20020a056e0213c700b003489fb8abeamr1311513ilj.2.1690361490295; Wed, 26 Jul 2023 01:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690361490; cv=none; d=google.com; s=arc-20160816; b=FPlfUzcuUuVBzj1OZtT/qLnFsdEGAvOztCNSa5WjsJ/3UZcpeonXQjO5bhIy/NX8/5 J1FQBxkYW/ik6KAUF4B2aOqP/B5u6nfKrDI83heYnHd+4XP9GL35qp0cmAGfXaUJlp+z mlK/eb0LTYwC+tGRuhXgAg4MWJo7k/Ybd/ztXbziC+smo6PW8DNYGP2ujqKcxg2J+vlp VyMsskMjb/g7tFY+j0d39UVt7m2TJtHUQK4u1i8Bo7wo/PJO2zEFar3346S/V/vUmK1C JsKgAruQJc50t3F8sk8DvorWKoJVgRiTIzWMhRqV6r2uqgUBH3hcsxF9Yh0bixaiCOfu 3jHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=uxYHfTTWC0VbYCKBrhIb3PnqWpEpbOJPVI+cSJ6lXqM=; fh=XjAwPJNpwlohQMMdGx/oMVy9HqRgn9mdGE+EAuIexMs=; b=P1c4SKqGVOyVLv4T7e9K9Wp7PWlr9w5faHVi17G55WqwslydCdmRn2oQcmc8av5AIo JL+JBJdoFVZCuallFzA5Y1GCXn6VbEsCQMWzfbzZq9rHwVfqidBM8JYL/nr539Gthjeo W3elUlpYQcr43Wfm7Te//VigDqbbLdz9Exzdt4TDNpKEDTz9TLotexyy5zjoA4ZvO9/G s+eu89ObhCUB0bTpgT8HNpogCmPoBLirULxf8Az4O32mC8/PNAzf6TrQPhqokQK0b7Xh ZLB7M4oS+DCn7yTUEz5hQAxj3ttjr4r9IL4GOTmjff0IqfeCyL8id2jgN/4Snifjx3Ro OIbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=XdoFUAw4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mi18-20020a17090b4b5200b0026838c1d91csi855633pjb.38.2023.07.26.01.51.16; Wed, 26 Jul 2023 01:51:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=XdoFUAw4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232302AbjGZIKF (ORCPT + 99 others); Wed, 26 Jul 2023 04:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232177AbjGZIJf (ORCPT ); Wed, 26 Jul 2023 04:09:35 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F20C6E82; Wed, 26 Jul 2023 01:02:06 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-986d8332f50so995466466b.0; Wed, 26 Jul 2023 01:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690358525; x=1690963325; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=uxYHfTTWC0VbYCKBrhIb3PnqWpEpbOJPVI+cSJ6lXqM=; b=XdoFUAw4biFlh1aW9Tx8YK5TjLabaDk3jclus9v8TlRqMpnmddMDVaohw3/vXv2Ili 1GQpj46+WdIQ8EP74ir6gi8o1fAereonW5jeNJdztHcyKygh+HbgXqIcusFT7QMCsXRc FOaZiZrgnG+oTe5dC+Dz/008dsk9vkCMRDN9gz+Q7HgXqzLljN5oohw4x8ZrMcDhwveS jhTJBioXifHwn9xyNmUHnvU52uC6DheA96xWi8rdeK5XxNZtD4AT39gH59/Q5rr6UF8F PkP2mm7W+/NO/6h+WIo0REDSbwwaKN7PVR+bVaRO7Nu0mOw4GrpsaFlNCPukWgpenD0E 2tuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690358525; x=1690963325; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uxYHfTTWC0VbYCKBrhIb3PnqWpEpbOJPVI+cSJ6lXqM=; b=hRAdltGW+HhlcSc3+zvzQon6UXMQxt02Cvh0bsygHMraXxTLwAT9Wy1I5+JvfuB0Xm lsLqR8QVRCzqR0wQ7yed4v7Mm5qAt6p3eIyhY4BdsH4p58EYhj39XH9T8UYZLaavTfPs P66uJuYkElajLdUEHzlYdqk5g7WyV4C/t5eLXeCIW9KGGSegExm0hNkT26pv+Cjpnl82 IaVWHDn/BfK2j2erGbmz7MCNs8A2yQsvr1GpbJ1VXxUquJqqbMvhjPKh0aWDFhCQatmP s+qRT2s677byKSahudsi5QuZXtM2Nsg79S7LwEVdfMn4wDeBsUzjHfeg9WSEcOGiq9mu T/iw== X-Gm-Message-State: ABy/qLbFTvppYnmundEe6vizcP3Ag2vorDINAWG+y1oUHkQGFuiAbaG9 naDj7GTS40qOp3zJvpAwkSc= X-Received: by 2002:a17:906:5396:b0:993:f6c8:300f with SMTP id g22-20020a170906539600b00993f6c8300fmr1010800ejo.15.1690358524845; Wed, 26 Jul 2023 01:02:04 -0700 (PDT) Received: from krava (2001-1ae9-1c2-4c00-726e-c10f-8833-ff22.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:726e:c10f:8833:ff22]) by smtp.gmail.com with ESMTPSA id lg23-20020a170906f89700b0098733a40bb7sm9314330ejb.155.2023.07.26.01.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 01:02:04 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Wed, 26 Jul 2023 10:02:02 +0200 To: Arnd Bergmann Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Steven Rostedt , Masami Hiramatsu , Luis Chamberlain , Arnd Bergmann , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Mark Rutland , Kees Cook , Peter Zijlstra , Miguel Ojeda , Palmer Dabbelt , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-modules@vger.kernel.org Subject: Re: [PATCH 2/2] [v2] kallsyms: rework symbol lookup return codes Message-ID: References: <20230724135327.1173309-1-arnd@kernel.org> <20230724135327.1173309-2-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230724135327.1173309-2-arnd@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 24, 2023 at 03:53:02PM +0200, Arnd Bergmann wrote: SNIP > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 05c0024815bf9..bc0eed24a5873 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -6965,7 +6965,7 @@ allocate_ftrace_mod_map(struct module *mod, > return mod_map; > } > > -static const char * > +static int > ftrace_func_address_lookup(struct ftrace_mod_map *mod_map, > unsigned long addr, unsigned long *size, > unsigned long *off, char *sym) > @@ -6986,21 +6986,18 @@ ftrace_func_address_lookup(struct ftrace_mod_map *mod_map, > *size = found_func->size; > if (off) > *off = addr - found_func->ip; > - if (sym) > - strscpy(sym, found_func->name, KSYM_NAME_LEN); > - > - return found_func->name; > + return strlcpy(sym, found_func->name, KSYM_NAME_LEN); hi, any reason not to call the original strscpy in here? jirka > } > > - return NULL; > + return 0; > } > > -const char * > +int > ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, > unsigned long *off, char **modname, char *sym) > { > struct ftrace_mod_map *mod_map; > - const char *ret = NULL; > + int ret; > > /* mod_map is freed via call_rcu() */ > preempt_disable(); > -- > 2.39.2 >