From patchwork Thu Dec 15 19:28:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 33804 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp559778wrn; Thu, 15 Dec 2022 11:29:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+dPcWbfgD/ZKJregzjcxuxtvgTBfmsbuZ0SsMalHpkSaTFTwObH7oGeN6B3ZJGCh0wpbR X-Received: by 2002:a17:907:a078:b0:7c0:f213:4485 with SMTP id ia24-20020a170907a07800b007c0f2134485mr25545203ejc.73.1671132593553; Thu, 15 Dec 2022 11:29:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671132593; cv=none; d=google.com; s=arc-20160816; b=Kg4n9zLYI1ZZ5Gb5fxW1s3GHCI+Rvi0JXHTsVNz6tKhEPW+7hYU3gr8jqZXK0rjPex /a+U83cfoTnH/nltxXB7On+a3O1CaNUEP7Hb3UVRqjrKlqfXXnluE0f6KeNrc7YiYwWB Kof4lNIpPbznb07RUeQySLLR1+Sj+tdXr9AmExaLW5EBqIdBGmnZgnOQJ6a+4UK/09mz SCJURwAHDwI0WwolYYKx3x27oAYiPzS85buSUldVz/lTpmJfdvEUSzVUByuGJUhw8Hzp mGDxMdWDZwnDtyTutqJsSlfNOvLtQ/moI7Y8b4QsRxWyJ2t63jjFfemM/mMyVSbtiG+J 6MJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=Tcnm4Zq93QUEsGpL/XwELq+tM+TYBnIw8vL4+pn2Juc=; b=O4hPogrlRfjt+rsWG7b/D54QkKUGcDiNlLHyEmWDZ9LyQhhhRc/fqPOQ6qpSdp5V83 YB7283x3ZnhuQ4z/HW3UGDuNXrWVf9utRqUQEnddwdgBXf5QBcwJi9ZzCC3O4jARrg67 wpoG4Z7PhQkyvCxzzYz6FUCMsjzqF9yAbbh51hr1kQSALfIcWVtc9mYp+fwSJNYQ+Zrz XxY8CETjGkne4nnOV0VVqRPPX4+mT//AoYCylJXymYWTjTBlGv0OIvf93q9JftZVWWU1 s4jZdu7M2kuIP+4fUoTn9OHZCKyF7gzborKeBg6EC+gFrX5SWKxhdWddCb3R5zLIqL9J gN8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=djhlXXsB; 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=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn21-20020a1709070d1500b007c17b2f6ba7si10146196ejc.1000.2022.12.15.11.29.30; Thu, 15 Dec 2022 11:29:53 -0800 (PST) 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=20210112 header.b=djhlXXsB; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbiLOT22 (ORCPT + 99 others); Thu, 15 Dec 2022 14:28:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229948AbiLOT2X (ORCPT ); Thu, 15 Dec 2022 14:28:23 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F59947310; Thu, 15 Dec 2022 11:28:22 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id l10so7893plb.8; Thu, 15 Dec 2022 11:28:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=Tcnm4Zq93QUEsGpL/XwELq+tM+TYBnIw8vL4+pn2Juc=; b=djhlXXsB0/6QWxwYZIivL1rWWU3Jgt1lnyFA1luTJfnAArtoWBQXRYf1klMZtruE3f 3ZClMW21ekZecQNwH+Y6NcYFgh9TI92hIAqpZNrpg429K0Au152qTR1MQdAlvyn+BLUz 79G4lwNmD66L36k76vbaXmpBebWzkEmCqe3LV57J2F92T7li+nnUpDbzAN9TxmimL14t sv48p2QjfyiOcmK/4hJLULCuDMkWusZeq7xINUt9cb171D6nRZazmcCbupZRx2jrJvfN d9NNtNXPNOhSJYysvE4q7A6A8yGkD9Fa/vm6ZskShaknok0qcMQbyH6RvT3uva532tfF MBrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Tcnm4Zq93QUEsGpL/XwELq+tM+TYBnIw8vL4+pn2Juc=; b=4mzEQnl28/zDW5iMfJKkE250aSISMZxzNV7WAxhaIni0ZQSilhbG+1+T1U9swtOcrf 2odoBT60/4TS1X1gaojLY8jr6TaRZIxyYbJ6yydnqGP12teJPpfZHtOGAVDsoQrMNTB2 Rlu4vV3yKXrWhXENkIOlCQqL0YN3VmKQL3OFajViDk77J0qn2Q1EwcYJWqv3uGsi2fmr X59uK3wpcbKEwdV1sIvLp3HGAAwn6CVrIwG/DQM5eol8ZfL2baDPpKTqmQZwEI0en8hA aB9tIoQeN04BTKIan7wTpn3gBDrIJEBLHryc/8fpIa4Yygv2GxEgUlTmcbgomPne3tFZ cM5Q== X-Gm-Message-State: ANoB5pnMRPew/PajQDzMs1/Z4b80juKOfYHznWOJJAaytlCUrdj3FWna FheUo2ISUAaMeOFUKDf9Z/I= X-Received: by 2002:a17:90a:fe0a:b0:219:8cba:cbbd with SMTP id ck10-20020a17090afe0a00b002198cbacbbdmr30647158pjb.32.1671132501846; Thu, 15 Dec 2022 11:28:21 -0800 (PST) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:ecc1:3e44:be34:129c]) by smtp.gmail.com with ESMTPSA id ep14-20020a17090ae64e00b00219cf5c3829sm3475129pjb.57.2022.12.15.11.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 11:28:21 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Andi Kleen , Milian Wolff , Leo Yan Subject: [PATCH 1/9] perf srcline: Do not return NULL for srcline Date: Thu, 15 Dec 2022 11:28:09 -0800 Message-Id: <20221215192817.2734573-2-namhyung@kernel.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20221215192817.2734573-1-namhyung@kernel.org> References: <20221215192817.2734573-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752309530487838149?= X-GMAIL-MSGID: =?utf-8?q?1752309530487838149?= The code assumes non-NULL srcline value always, let's return the usual SRCLINE_UNKNOWN ("??:0") string instead. Signed-off-by: Namhyung Kim --- tools/perf/util/srcline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index af468e3bb6fa..5319efb16a5a 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -716,7 +716,7 @@ char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, if (!show_addr) return (show_sym && sym) ? - strndup(sym->name, sym->namelen) : NULL; + strndup(sym->name, sym->namelen) : SRCLINE_UNKNOWN; if (sym) { if (asprintf(&srcline, "%s+%" PRIu64, show_sym ? sym->name : "",