From patchwork Tue Feb 6 11:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 197318 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1465874dyb; Tue, 6 Feb 2024 03:14:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFI53gXblF+T79BNAblL7jvBWXM2jrs89pGkQ1GnnafWiwQ/ubRj917WcQUXtKSiTOrPtal X-Received: by 2002:a17:902:eb0d:b0:1d7:836d:7b3f with SMTP id l13-20020a170902eb0d00b001d7836d7b3fmr1700139plb.9.1707218058916; Tue, 06 Feb 2024 03:14:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707218058; cv=pass; d=google.com; s=arc-20160816; b=RtTVghDt1eqXrO+rmRmxVZfyW5rF7+8V2fsRbm2yzvddhcTN4gnR9qKYsyjQ/wpIAK f5fy8BzRFfA0xV+54yoMUumCFCwb8C10Yx8mWlYQf+OnYCxb4Vr6RCFDk3gjcHPwhNHJ tJ+jxJIqEpj2TdwZPnsPzk4eSg0njsIxRfB6vI2Gg4mJobwWfPNXEBCEdb4HPZ1ofBwf T0BqcLxgHwH+4YbCZM9PkGWGwNOQ6XycqCq6ryGddtmQcDJIW0ipwvutTNyW+gvq6GNQ IQnuce3gQMUqDD1N5yYzMk1UCmb3pOgZFrqcliDrP2HkkyyoPhcUMIBLz6CycVUi2ZCc 8DTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MKuoO2kIaYmdpGDPocS5JwjLbuAPJdgjgpItbCuOabA=; fh=V55aaT8LnmJYhLTfMKCfnmO1g3Kcd4GElJxxICHn6vE=; b=VciIQGTDJuUgMdUdVL4R8dqJQIR9hRRdDl2aQniiY2x1d++0FZZyIkOHtTxyga9Ltx KmFMJChZutvpOgjacNMaGp2rF4FQSsySJTjFDuNs7efUMD9Q2YUp5GWSqZFaN336O53y FdGwdBGosnUiYjnhjO+HYL2Qq3weEiS95XT7C0PoZBA5sG6TS9Czy336k5qa9yEnN9Rj praVqg1NraAUgpBv7++vyk3iHQYh00Up66WmGf3eGOxb0Z9kg/PBmRKtC7Nkf3z+lJoG 8IXm0V16O6WnY/MSUg+XplDABYvhhkfb6/ROf1hMAF7pdMun+1JDdK3jX6DHoXcU+1BH NXVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1YMZore; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54737-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54737-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWI6Zv5VFGQyuwkPZVv+1DGT3DEoWTUvbvIHo3GANJT+OHXzvsdo5DftXKPN/zv0sfn2ZZDpUda3SBgvRr3TUn1KrZxnQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i19-20020a170902eb5300b001d721ef24fbsi1482309pli.579.2024.02.06.03.14.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:14:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54737-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1YMZore; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54737-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54737-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 83864B25BEA for ; Tue, 6 Feb 2024 11:06:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA77212F59B; Tue, 6 Feb 2024 11:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X1YMZore" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2849612EBF1; Tue, 6 Feb 2024 11:05:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217546; cv=none; b=ivkgRbgbmub5rKiVtyd4N5r5e6/C0zvKJTAygBFpAN28KFdrtEj6vRWCAL/1dK2j6BZRG9PIMQhBjzEr1aSd0qs8gcCJRsRSfPnCTyUNCcHA+CBX/MVUW0sW5YkcTiD4d+Q154Jgo/bSSXpdRB359kLTZxmOPcX/lPKugl7et48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217546; c=relaxed/simple; bh=H+Nq8LvP8FkxrlJRAmYgk8e/3dEvC0tbNoCGSHxyVo4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ioeBjY4eqEQcizuGJeyGsx4BCyHAWX0gHm8JmXfKAhaNwB+0Hh+Qz4qjtPDnAaRKlDW8/8t5Vn49DrXSQttF/Pce0P7GkyThfetclItYWMSC5GK2IQJpH9Tm/z3zGyBtTWM6khaac4s2W3KBfV9Qec7Uo/OjDFQHAMzqKDyUWGk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X1YMZore; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1E4EC43390; Tue, 6 Feb 2024 11:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217545; bh=H+Nq8LvP8FkxrlJRAmYgk8e/3dEvC0tbNoCGSHxyVo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1YMZore3LK+hCmmjIJLFzaMEHTPS9Qer8HNeXEdoITlXgsKwybVTMlk7mMKDGKYL 5Lxx2Wcd39OParl2MLKcQlUctSN1L7TYfrEpzMGRxxDnLkyi3RRNvDUdsRudp0NqLo QUqF93n5ZJqy/MDPF6N6FUsR6f+taP3kDkJY1EmYfyHTfIsEFnVCePQSihf5/K2AqP 8d6ZuSA2UCudZedqbbxHF2K1EsMxyDiP7N1aT+vDWRgr27TV8/37pIX7c/9hojch1y pWeOAEQuegm7z7CXj2SDZEdxh7aTj7lE4QW1m/TSaWluNkgizRgdaqyuW5JbIZ68oy wB+HVVlTBS9Yg== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 1/6] tools/rtla: Fix Makefile compiler options for clang Date: Tue, 6 Feb 2024 12:05:29 +0100 Message-ID: <567ac1b94effc228ce9a0225b9df7232a9b35b55.1707217097.git.bristot@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790147883347745743 X-GMAIL-MSGID: 1790147883347745743 The following errors are showing up when compiling rtla with clang: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [...] clang -O -g -DVERSION=\"6.8.0-rc1\" -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized $(pkg-config --cflags libtracefs) -c -o src/utils.o src/utils.c clang: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument] warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option] 1 warning generated. clang -o rtla -ggdb src/osnoise.o src/osnoise_hist.o src/osnoise_top.o src/rtla.o src/timerlat_aa.o src/timerlat.o src/timerlat_hist.o src/timerlat_top.o src/timerlat_u.o src/trace.o src/utils.o $(pkg-config --libs libtracefs) src/osnoise.o: file not recognized: file format not recognized clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:110: rtla] Error 1 Solve these issues by: - removing -ffat-lto-objects and -Wno-maybe-uninitialized if using clang - informing the linker about -flto=auto Cc: stable@vger.kernel.org Fixes: 1a7b22ab15eb ("tools/rtla: Build with EXTRA_{C,LD}FLAGS") Suggested-by: Donald Zickus Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/rtla/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index 2456a399eb9a..afd18c678ff5 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -28,10 +28,15 @@ FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \ -fasynchronous-unwind-tables -fstack-clash-protection WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized +ifeq ($(CC),clang) + FOPTS := $(filter-out -ffat-lto-objects, $(FOPTS)) + WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS)) +endif + TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs) CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) -LDFLAGS := -ggdb $(EXTRA_LDFLAGS) +LDFLAGS := -flto=auto -ggdb $(EXTRA_LDFLAGS) LIBS := $$($(PKG_CONFIG) --libs libtracefs) SRC := $(wildcard src/*.c) From patchwork Tue Feb 6 11:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 197320 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1466897dyb; Tue, 6 Feb 2024 03:16:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7HoAbGF0L+ohDKReX1tDdZE+Efd/7Wt/giUgx7rF6vRZgZjeQTmf1rZtLBVfY8rVvTweo X-Received: by 2002:a17:90b:3ece:b0:295:ee45:4ed5 with SMTP id rm14-20020a17090b3ece00b00295ee454ed5mr1992331pjb.12.1707218195396; Tue, 06 Feb 2024 03:16:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707218195; cv=pass; d=google.com; s=arc-20160816; b=woCeUT8USgYc15NpMIaruB4RrIb2LqC35Mv0+kdV4IwkAIxLCeZ1RCi7llDXZZ/a88 K+Rh5jJE0eYu2/vDK6CmBnX49II6zlDpmpwhRRmF3uGMpx9R43vWBm2WGCByB49ZbLoJ poGDdVWNCCgkbqZAboPN+Yw5hc+QvI86Dk0iENPIdLqhtL837cwcPRfwlL0F4nPS5Fww 94aIaruGOamPFdSWJgXxcqlTQ1ZgLlluQUzX4FhuyzmEk4DGGXqRmPnOXbrOrIj7AjNO owcinCtuTTN+e0LFF8xFbKrsQ26ZXU5gt/tXEo8tQU8o7WvDUNEsfdvk9y7IkpW091jJ XrlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9sJO86zBXK8RXO3EXpyVpk/zElUPifC16tcYJO/FLO8=; fh=FHJrfo+T1B3zP4KReLjzGAr8gv+5WokNeVPi2yO+x6o=; b=B/hmjNxfBfd8D49vlsDkgA7BuutVyAbTU2NRRLK6J60Bdvv2xwVRm2bhsTNzsIf749 tQvjhhvs7z4/nm9es3L2M2LQJRfqUk6Dw7DC7/QbDyw+pQXkKuAWYY1OmqdZwP+3o/Wc N21LtQZ0V6Quzq8rvFMoLvJcZYr33uYqEMZLtkndf4iq6Vkb7GuFynDLFtgdAmNYGZ9I ez6zGh+kK4uoE/i2HZflx5dk6QFIOeNtQkAE+gceLxfWOQ1u32iQwqX7ghhzGzUWc2Dj +HWacE9M5/VKuF9CI2gm7ypzHm/Oe2xzT0fzwznY+48114JXBtRzAt8VVwYN1L4pl8nP JosQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bcwBOYz1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54738-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54738-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCX079eejDKFmbhupOvfJMVOJRiEvUMhDJJ4SnR5Im38uQxFxXhFBDgb/7I+T/aJwrBC57nePpMQU7vr/muK/PbR9xqpUA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w11-20020a17090a8a0b00b00295e3413670si979404pjn.131.2024.02.06.03.16.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:16:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54738-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bcwBOYz1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54738-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54738-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C430D28AD6C for ; Tue, 6 Feb 2024 11:07:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82CAA12EBEB; Tue, 6 Feb 2024 11:05:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bcwBOYz1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A27C512F592; Tue, 6 Feb 2024 11:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217548; cv=none; b=fFHd3qwfhaoapvWWQ72aegCbAI9Cw5zRhJ3nmagWpsdPBfhYSaT4dp93ea04Nh4JHcqZXsNdyJR/YKVu5UKZ1kS6thtcjyslTWFU+9S6q8/1lDGGi4pouL1TjwzdfvwRcnQxw4lCYr6p8YbctuSY1RUWngGJHsD7F/tUEMIuMrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217548; c=relaxed/simple; bh=hJBcq6G53sR+Sok4UfO9asd3HIeiHC7fn0zZDIFhFKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=goiCOaVPIJfKQlEwb9Hty2TfDYqq/nmN3n2PVfWZoftZQtSkMRJhiAWeNPoP+vMFG6DfIGmDLCSFGO7cyffn04nfl+UuWuJtuTK647nTXV+u54EU1omxVX+3N/cN2THk3c6GqwOJMBlQo/gLN4LUQ5zNs7thvPBdu97bH64vFtk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bcwBOYz1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF0A1C433F1; Tue, 6 Feb 2024 11:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217548; bh=hJBcq6G53sR+Sok4UfO9asd3HIeiHC7fn0zZDIFhFKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bcwBOYz1BMGlcZEu4c59TB4CPKUsT2QK1ewkFW+0mBdhO4CM8hRvndL7AHm4wI+Q4 g9WJvsh4FAsHgR3mUJFsLDAkrD7p4n+kzbdf+5wbUMjZarqCPtjb1TlgedNm7bjVvS 9/hjcRzqqIi9TdAsjXOu+0PvqlpTS5FIvuY71mRr0AYi0xIk9nZZg/bzZtWDqzbf+M p4Ed8JBdvVlr1/kONzexSsLh0xcXtXCkLN3jQnpJbiJhAq0enuqhLU/FXyTZN2S+eX JEdu0w1MgxQbzzpkkh99Ie291zgXpSTB2WB6m5nhauJKf+IXr5Dqj8OxYEisPgwId6 AUr3L3KgjEUtg== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 2/6] tools/rtla: Fix uninitialized bucket/data->bucket_size warning Date: Tue, 6 Feb 2024 12:05:30 +0100 Message-ID: <6e1b1665cd99042ae705b3e0fc410858c4c42346.1707217097.git.bristot@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790148026023899415 X-GMAIL-MSGID: 1790148026023899415 When compiling rtla with clang, I am getting the following warnings: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [..] clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -c -o src/osnoise_hist.o src/osnoise_hist.c src/osnoise_hist.c:138:6: warning: variable 'bucket' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] 138 | if (data->bucket_size) | ^~~~~~~~~~~~~~~~~ src/osnoise_hist.c:149:6: note: uninitialized use occurs here 149 | if (bucket < entries) | ^~~~~~ src/osnoise_hist.c:138:2: note: remove the 'if' if its condition is always true 138 | if (data->bucket_size) | ^~~~~~~~~~~~~~~~~~~~~~ 139 | bucket = duration / data->bucket_size; src/osnoise_hist.c:132:12: note: initialize the variable 'bucket' to silence this warning 132 | int bucket; | ^ | = 0 1 warning generated. [...] clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -c -o src/timerlat_hist.o src/timerlat_hist.c src/timerlat_hist.c:181:6: warning: variable 'bucket' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] 181 | if (data->bucket_size) | ^~~~~~~~~~~~~~~~~ src/timerlat_hist.c:204:6: note: uninitialized use occurs here 204 | if (bucket < entries) | ^~~~~~ src/timerlat_hist.c:181:2: note: remove the 'if' if its condition is always true 181 | if (data->bucket_size) | ^~~~~~~~~~~~~~~~~~~~~~ 182 | bucket = latency / data->bucket_size; src/timerlat_hist.c:175:12: note: initialize the variable 'bucket' to silence this warning 175 | int bucket; | ^ | = 0 1 warning generated. This is a legit warning, but data->bucket_size is always > 0 (see timerlat_hist_parse_args()), so the if is not necessary. Remove the unneeded if (data->bucket_size) to avoid the warning. Cc: stable@vger.kernel.org Fixes: 1eeb6328e8b3 ("rtla/timerlat: Add timerlat hist mode") Fixes: 829a6c0b5698 ("rtla/osnoise: Add the hist mode") Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/rtla/src/osnoise_hist.c | 3 +-- tools/tracing/rtla/src/timerlat_hist.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c index 8f81fa007364..67128171c29d 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -135,8 +135,7 @@ static void osnoise_hist_update_multiple(struct osnoise_tool *tool, int cpu, if (params->output_divisor) duration = duration / params->output_divisor; - if (data->bucket_size) - bucket = duration / data->bucket_size; + bucket = duration / data->bucket_size; total_duration = duration * count; diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c index 47d3d8b53cb2..3a5b8c409e7d 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -178,8 +178,7 @@ timerlat_hist_update(struct osnoise_tool *tool, int cpu, if (params->output_divisor) latency = latency / params->output_divisor; - if (data->bucket_size) - bucket = latency / data->bucket_size; + bucket = latency / data->bucket_size; if (!context) { hist = data->hist[cpu].irq; From patchwork Tue Feb 6 11:05:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 197317 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1465682dyb; Tue, 6 Feb 2024 03:13:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlTenFUIk8yp5pC9qAk65NweX4pTwQD0onOnUlEz2cDBL41yLzFjxi1XGnVXcm7N8MAVzA X-Received: by 2002:a05:6a00:b33:b0:6e0:3329:1044 with SMTP id f51-20020a056a000b3300b006e033291044mr1791568pfu.29.1707218034936; Tue, 06 Feb 2024 03:13:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707218034; cv=pass; d=google.com; s=arc-20160816; b=lfxH2pPU5CJxK+GhU393h7rm3G2wzZ2GFEV1qSnL8UiBo1Eed7LYm+MSZg2OcElDo4 KKOvSAjYa4Yoqxaly5OELgrKFpTIHWn3UIqpyUOVKeK86Tw2IcsJ99n33/GbIUhacxVw Hf97bwiAgiIOymjUaSzWCqiiRyWSBx9IP1+MVEYvq0Ym8MdXhqIxaQNFVG6r7BlN2MZ6 HBOouadRvUkwovxvBovmRTuEuW2i612KEPg5SNkhdPJKVbOy+hP3RUIfYqN+Zr00I+59 KO7WjOBspzb3Md/hyd885GExXycSajHZ3hQ7I0nDhj7bkqtwpGTe88QE9ZANro9NjXHt Lanw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=a3sWO3ucWspFzjxbk0W6e1miXmwGUIIvGytm8MaRiE8=; fh=NsOVKdqP4s9RWwyfUIeevPYJ4w0YSA6K50tjufmEsTY=; b=rzvyghFBnQdFMdnVilPfUHknCWVC1UZ5rBp8SIr5O8VAsrsba0KWYc/+JO8r/UsMdQ udlwEmpgT3Dby7Q1qHbkDOgrDF7gXZhLz5AYMZ8nUF9Wnr9XPSA/J6+pmfEzjSEZTvtw rXnVuHSeZ21psNJAck+3meTsCm5oQDLw6TKMCOlr0efRLOa8Ze6SURmvBtAHYtatcJXa WNzY8uR2yfscpCuB0hNyxOFMydVw1g/ME0haeqd4JBr1PbwAPjU/aM9aLNUFAroBBlN1 rr1dPd5AkUxj1Zisl7sMH4/Dbq5IJOT+/R5izIf0SMzWyHQAuzrFs+AEnHqL6p/aiBni nMiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MWvy0TH6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54739-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54739-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWBNTJwb6u5lZ7MQE0MWRg4+wctsK7gAjiS/Nq4az6/4F4lWBs86HifaYQbwvf6qi0YW1PQbKvX8sHko2uztnbMDZQYlg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id gu8-20020a056a004e4800b006dde04e1839si1475927pfb.63.2024.02.06.03.13.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:13:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54739-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MWvy0TH6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54739-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54739-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7DB6E28AE7C for ; Tue, 6 Feb 2024 11:07:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B53E5130AD2; Tue, 6 Feb 2024 11:05:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MWvy0TH6" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED22112FF76; Tue, 6 Feb 2024 11:05:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217552; cv=none; b=EPYKXp91RrvGyMwZY0DjL4rsaTh7X+FpZVveQz51rXe+93DWREGEmYTVsMJ1MmKqbd6c0kWOc9EXV02jCJzGlhEaB00YjgwCcLEM6RRRAsYM9KBR7R6opvn4C1aVN8zz4tM+xj9T2MbZWphYsOEKLChqh6aWIxoaO9FeNwW10wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217552; c=relaxed/simple; bh=HBpkihUOz+42qTZ8E70fvuC94UrnuMtLk3YD9XXg8zY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MO7a6/9IFYc0qHhdKGvORfTX0NK1WESqqTYPa9iiZnHGNHIboaO2hlQGjRhv6vWa76mu7S7wvi6oExTEIIdhZ/FwRHGxrK3d8RXRcUGvEyjE9/5wgcV85e3G4BoSr9muufk7G7v48bKNm6ehS73yhE5qSe5+XGW+zxId2UNqneo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MWvy0TH6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5F89C433C7; Tue, 6 Feb 2024 11:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217551; bh=HBpkihUOz+42qTZ8E70fvuC94UrnuMtLk3YD9XXg8zY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MWvy0TH6y70WyLpUralBEy1uvKuZYhREElojJQhvCasstwIFVA6ZDTE3y2ZhvVnf3 Uvg/RBvyK7RRGTSI3dU1S5Mu9YS5yTRt7zy7P/kScj0CeSKOaduC4l+lQ2zqzzKBt7 EW5b10Br+lMZJ+yp9TDtxhlq64u+0ePeOWOxFfJq3k/LhKhvTaevgTzUKjdRb7nqCw fN7JdlbEDUcQm89rxay+oxj7kyKk9IB4z5MdrVmyWu91xVk33aEnPKTbQKCwi1gVKc mgyEPNSFKKjUJZg+AHkXW73VMoL9iuRGe+VOWkogskl4IOOLKKpLOp1RiEdwzccEZg ToL6obNvwEUXg== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 3/6] tools/rtla: Fix clang warning about mount_point var size Date: Tue, 6 Feb 2024 12:05:31 +0100 Message-ID: <1b46712e93a2f4153909514a36016959dcc4021c.1707217097.git.bristot@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790147857977672890 X-GMAIL-MSGID: 1790147857977672890 clang is reporting this warning: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [...] clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -c -o src/utils.o src/utils.c src/utils.c:548:66: warning: 'fscanf' may overflow; destination buffer in argument 3 has size 1024, but the corresponding specifier may require size 1025 [-Wfortify-source] 548 | while (fscanf(fp, "%*s %" STR(MAX_PATH) "s %99s %*s %*d %*d\n", mount_point, type) == 2) { | ^ Increase mount_point variable size to MAX_PATH+1 to avoid the overflow. Cc: stable@vger.kernel.org Fixes: a957cbc02531 ("rtla: Add -C cgroup support") Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/rtla/src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index c769d7b3842c..b998b24edf1e 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -536,7 +536,7 @@ int set_cpu_dma_latency(int32_t latency) */ static const int find_mount(const char *fs, char *mp, int sizeof_mp) { - char mount_point[MAX_PATH]; + char mount_point[MAX_PATH+1]; char type[100]; int found = 0; FILE *fp; From patchwork Tue Feb 6 11:05:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 197314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1463000dyb; Tue, 6 Feb 2024 03:07:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHd84ehi2Rl09iPiBkbRjl38Wxzsa1NomC4VPxA0QLoxR3+QUupUQXTWBrRGbGw09IOkjCD X-Received: by 2002:a05:6808:1245:b0:3bf:e036:f0e7 with SMTP id o5-20020a056808124500b003bfe036f0e7mr1945570oiv.56.1707217672269; Tue, 06 Feb 2024 03:07:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707217672; cv=pass; d=google.com; s=arc-20160816; b=ccc/Ap/tdpY+cHtfoxYZjHV7vk2wmUc4INaLnquMY7lU4BeG9IuNuv//1owsVQuBky Q1eOU4TGGMCg+ZrvTW8XB3Uq+pbqKLY8e+rpYid/ALkJLCZiJiJ8zSTBALmUoGx5MXi+ K4VzTwbA3kw4ECxSZOf90aJ6R5/rLjyqZxJqjA+znMsC/yqinvphsfmcWUymCi59Po1q JFRXJafJVyQHsaSwVBnt7/JpHSHzQzbs+V9OjC8fmmeHxfAj+BA5snwlGqUJ1Hm95Nqr YoYggkv3pMHiCdGfY6PaaJE77Ea/u0HbSuTzgVfV2fsNPs6EXQcTbrPmed/jMN+UphMj WK1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zog73/y591CHpqxJbB4NLPV+ZYmrEq4Cyjh7ugOe3as=; fh=y1QSHczrb3iAIY72qv9GaOyRjSceduSSSZNVD+etC28=; b=VQHgQBhmvuYYgTB5KwjpCZk5eTnJrZ0+SvzWKRZ2Ekn65+PZfdUJVLSM4V9GPi0DgC nzw1BtIZQ+q0HOg+6gXP8qPqZCUX71du5dXwpV1SVJ5gltTqq8kwl/f27EkPWDQZc5NN njKjc968sytnBBSThsf454IjSyjr9Th/PIih30TYJ3J1ERJVDj56AevsA9xIGoJpzHQj vcyg5k21236i2FjwreT5mxVgQ/6VjuhNoNHlbIj1+Igqo+fy4+N8awue4wkEowFOPZNT urikdKIWRNQoLhWWmeT9iy3W2RMjJW9zKYd+OOeHo46NIPD+ezy2W1MXbUTjVfp1L5/5 2PZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UGTxcVLx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54740-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54740-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCU+80Sjr0qtTApoh7Vhyljvohzhu21/tAhZXglS8n4J4uRM4GaQ6QP2EDpIqB8he/qQ9ez3wY9RkvFQYnjn3GgEjXtIVQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h8-20020ac85848000000b0042c2815773fsi2082163qth.180.2024.02.06.03.07.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:07:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54740-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UGTxcVLx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54740-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54740-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EB9E81C219D7 for ; Tue, 6 Feb 2024 11:07:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F025130ADF; Tue, 6 Feb 2024 11:05:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UGTxcVLx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5A26130AD3; Tue, 6 Feb 2024 11:05:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217555; cv=none; b=imfEcmbWovZkCAyHb88spnYbHFt4PoWi+Z0FOf8y0NfdNuc/ZLf0g42yCdXydzZOhiquRuHzvZtQ/OX9Mj3l4WOJhS2eODuuqnkfvzBxqnh9NT+E8SIUT2bW9RCqzXL3imBQeDiVqoG20s9bEO4msKViBCzmvEuFDfCX30tja10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217555; c=relaxed/simple; bh=rDmpciVOtng6F7rfQEs1JlIM6VsqeY8XNBiItpt3u0o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fOaut82lchQs/3UPZS4znraoxV/7XrqqXhEiqYXqQyETEFmF3fN1YwpSijDBg4/Iqn5CV6hUtpjFk3S5P9vKnZDGpe65uDqHfsFdl+2i1V8zte6DsGoogQCEvcx8PyXAt6H/ASguN5CBMthxXxHLGfc3HXMSzZtGW6NSH6qjxfw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UGTxcVLx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB4DBC433B1; Tue, 6 Feb 2024 11:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217554; bh=rDmpciVOtng6F7rfQEs1JlIM6VsqeY8XNBiItpt3u0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UGTxcVLx1FDdDingKcw57Mv7aaoCD1DBkey/KBRNxqwFqI5QwnsMNNwYez38KWT1R iGjKkGNQUJNL/0H0PC5LaijC5i3ai+UsENlOe8KWHw3JKg96rieo1KNV+6wAJWqXcF sQiHZXTr3horKlqnshJ8Eb+X/NizW/Do2rH7G1xpRsBK02xDSiA6tjSJgE5cb9G8Ib 9bd/jHhQOfvZl7cfBoq676uY8FKex0PjODw/MRHbfbkk9qTirD+f2FWGtWD7vdQcVa Lajc++Ir9dNnkvvN2q2vaYB/14qDS7BWOaB98fKvT67NgER85qbQr7xq2jWSyIJyn/ 7IyhHwftf8hOQ== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 4/6] tools/rtla: Remove unused sched_getattr() function Date: Tue, 6 Feb 2024 12:05:32 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790147478027050339 X-GMAIL-MSGID: 1790147478027050339 Clang is reporting: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [...] clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -c -o src/utils.o src/utils.c src/utils.c:241:19: warning: unused function 'sched_getattr' [-Wunused-function] 241 | static inline int sched_getattr(pid_t pid, struct sched_attr *attr, | ^~~~~~~~~~~~~ 1 warning generated. Which is correct, so remove the unused function. Cc: stable@vger.kernel.org Fixes: b1696371d865 ("rtla: Helper functions for rtla") Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/rtla/src/utils.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index b998b24edf1e..5fcd6495ff05 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -238,12 +238,6 @@ static inline int sched_setattr(pid_t pid, const struct sched_attr *attr, return syscall(__NR_sched_setattr, pid, attr, flags); } -static inline int sched_getattr(pid_t pid, struct sched_attr *attr, - unsigned int size, unsigned int flags) -{ - return syscall(__NR_sched_getattr, pid, attr, size, flags); -} - int __set_sched_attr(int pid, struct sched_attr *attr) { int flags = 0; From patchwork Tue Feb 6 11:05:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 197319 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1466570dyb; Tue, 6 Feb 2024 03:15:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvNJO6QigxyZlqc/xUNJwxDOFVD7GqaiyyKCzTMwetM+o2GIYy/kT2pTEED2F+5Jt8fV7v X-Received: by 2002:a05:6e02:682:b0:363:b2ea:5771 with SMTP id o2-20020a056e02068200b00363b2ea5771mr1902240ils.1.1707218152526; Tue, 06 Feb 2024 03:15:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707218152; cv=pass; d=google.com; s=arc-20160816; b=ccHMRb9DLlFVcNxGCXC2BM9NGn0rasEDgwu/ZOIL0ch51AL9IrtRJdH4Q9KSU8zy4W NdBA0Js+9rH0yM7NiJLxVGpxJpvGP1f9AO/xYBj5mnrykPSjYwabi5oyBgbz+X5IEumJ T+Q9Xiomk7xjm6PUrubzLwS+Tk1RlbEcuifScLNkqLbnzugPHe8OP9ucKj8jy3DKj4w4 4BLlXVKtNvVOKcay3HIVzq2ieM9omjfICC+b1iXX9wjAfV/kbPSrRazIN4qTVsdxGElm 3YyLSlxYPc4WzkwDXSxju0D6ckbQYUE3pmwV7o+AEPHjBaqxVdci/YS/jNi8hWYgOZfp Kvzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TM/poG8G5KN3+0IMsvniInpYO948zppMnBPycF1iGjk=; fh=X4TuQorA4Pi/ghHZecpVsvqlfcOcGj9S78YswfKTUj0=; b=qX+aVUn0lpYf2HOSO6TitNfM+GmW3GUZcsCd0yACgawXpGExrgddWJ4ha0PMCEMCW+ YVSg9bqspkou04ovKu51MxX5giWtiY5yWKgj67E4x2ag1MjrvWOYD4uPiLDclAf50/7b K56B/W66e6khHJFGM8sEEvEAoCoHW9B04R4jJJTA23CGx4FuS5lIPiB3KYTvdAVPSyQD XMD/0RwYz5zaiZ5D21Nf1TFVC1OkXqLZrMfuxhSkszAIMa1DOgpLSreDKzs+eeqcvEP0 uAeDuqYrN9I6RJeJQCoIjaCIVELvLMx5SFTxCzYqMUDi+tdcFpat+esZvKe6YtnZCu8h TFUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XfNv2wNL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54741-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54741-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXVp1X+vU1GYS97xIcH+J/6O9F1YJEGAvSEw1CVDyKuNxCMN4R3ara4v9qI0v/cGUCvJLirX07YRvwphOc1cQWx6qa7nw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b21-20020a631b55000000b005cdfddfe6c8si1438592pgm.711.2024.02.06.03.15.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:15:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54741-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XfNv2wNL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54741-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54741-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 513B0B26F0A for ; Tue, 6 Feb 2024 11:08:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95C9612F5BB; Tue, 6 Feb 2024 11:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XfNv2wNL" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7850130AF2; Tue, 6 Feb 2024 11:05:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217558; cv=none; b=hF+ek1yDNxbQryoDfwkH5coFcG2GxlrrGRCA1aVOfWbR2z54oUpbGxY8vVdL0AQ+QLHtwyIBnNZRLtboC79+LFOtSiTvc6afPYAMlf1vb65Spg0vciEZfLBlqqj/3OKq58iGtDljvNWQhzGB+xIL+lSza6oPfFGej+wdqzbWECs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217558; c=relaxed/simple; bh=oBgtkf5GsR7oInvTgvXmuuezLk03GfOH/+6u6oZvCho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kSabcQ/qDLBbaDuc42kcGdTo4SK7BFblGdz7Wvr4zxYiiOmyGiDEjUd+5QRrbUAWEJ9I7shaIxEHCJhYJ7vS8udnVAbcpYicVPIIQmi6b8wfmaR1ot+nx5GQ2+udwHkuocboekKCaiWm5X54oP4I5lembpuF4JkMhfSXttPFloc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XfNv2wNL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE566C433F1; Tue, 6 Feb 2024 11:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217557; bh=oBgtkf5GsR7oInvTgvXmuuezLk03GfOH/+6u6oZvCho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XfNv2wNLBieC8aH78hNfv/GOF8mA9hhZmEPpD6sAgcVmpsetChkXkZxAQjZA8W/qB vq3e7vtbYLs9eWyE75mfegnu/BIje/RaSfhfkG3Z1lop7paRAhULue7h6ecnY7Ixj0 4B4MIuqKYCqSdKbDx17zLMT+Q29oXRv6HpBrMnOMoeS+EipoolxR4oVoskghah3u3z zLPCI2iJO+c47fgM+nRJ2KETK5hbRdcunESQpSxzAgExHiEnoWLbj5WYUDYzhLxVf1 hG0SEV0+v1h4yPYRixQHCHsap/5qDGLSe9LdB8BBsvW3LydH85CwtgNTJHgKhF8D+t ly5UkWT4NfseA== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 5/6] tools/rv: Fix Makefile compiler options for clang Date: Tue, 6 Feb 2024 12:05:33 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790147981560864622 X-GMAIL-MSGID: 1790147981560864622 The following errors are showing up when compiling rv with clang: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [...] clang -O -g -DVERSION=\"6.8.0-rc1\" -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized $(pkg-config --cflags libtracefs) -I include -c -o src/utils.o src/utils.c clang: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument] warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option] 1 warning generated. clang -o rv -ggdb src/in_kernel.o src/rv.o src/trace.o src/utils.o $(pkg-config --libs libtracefs) src/in_kernel.o: file not recognized: file format not recognized clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:110: rv] Error 1 Solve these issues by: - removing -ffat-lto-objects and -Wno-maybe-uninitialized if using clang - informing the linker about -flto=auto Cc: stable@vger.kernel.org Fixes: 4bc4b131d44c ("rv: Add rv tool") Suggested-by: Donald Zickus Signed-off-by: Daniel Bristot de Oliveira --- tools/verification/rv/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/verification/rv/Makefile b/tools/verification/rv/Makefile index 3d0f3888a58c..485f8aeddbe0 100644 --- a/tools/verification/rv/Makefile +++ b/tools/verification/rv/Makefile @@ -28,10 +28,15 @@ FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \ -fasynchronous-unwind-tables -fstack-clash-protection WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized +ifeq ($(CC),clang) + FOPTS := $(filter-out -ffat-lto-objects, $(FOPTS)) + WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS)) +endif + TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs) CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) -I include -LDFLAGS := -ggdb $(EXTRA_LDFLAGS) +LDFLAGS := -flto=auto -ggdb $(EXTRA_LDFLAGS) LIBS := $$($(PKG_CONFIG) --libs libtracefs) SRC := $(wildcard src/*.c) From patchwork Tue Feb 6 11:05:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 197322 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1468090dyb; Tue, 6 Feb 2024 03:19:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCHLax5bFHdW9biSkHY5ZIpsg4JHD7/6+eXMCixkTL1PXw+GGXnVNN24Bbu1CBilUDdBLm X-Received: by 2002:a17:902:eb53:b0:1d9:bbed:fc20 with SMTP id i19-20020a170902eb5300b001d9bbedfc20mr963521pli.51.1707218352890; Tue, 06 Feb 2024 03:19:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707218352; cv=pass; d=google.com; s=arc-20160816; b=Pbt31VjHFu1NGj9BGMywM2+QCTgQUJHT0kbfydZOHXRacAzPjqjfJbt513zpK5RQie Zwc5L8D0yp4E+aNZv3PuiTltsUns8FxNTT1Rxwrzn6hpYb81qIddbupBZ4lKLsak4y5h 6h6YvfkZDw6EKzVq8wTSLsA6b8D1svRdEx7/V/KH7fzFUY1i08PD+aeElsVi49zX9Ccm Gp5Jx3G42f8mGze54Ys4fk2AgEShAdP/EhEnQ7OWfePhvFMk2uWAVdmg+YKFkN1jKCcY oiB7TFRJZ/F3lAiOntVEVUT42XzH5DPg39C2zCzMSAnn99+4apAkCjI9bxcsuLwR+Reb k24A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ihP/STyGhHBNsgdLn3al45hLbYgNbjRO9Lw5zHfgDkQ=; fh=lSwFs31hjHMjHnSnXHKr7bXqOKf9PU543EVp20d6/40=; b=vDGwSfVOcJ39C1VjOwPr2vAl+dIZPPUXGMVr3wrCdo3mMmwM8UoDdSzBVS69MB2aoz Bk82gIqqRq6InjLMPmHcPbu0/tttwDy0InvPNKFVtlE8xioGgNzKSIEjS86EkEPzVAa0 8IYRX4RpJ8nqwLjkAuA3W7JZoJkW3vcgZF0d5V+fIXAdj8cFSBD/Eft4NqsMVIzgd/ou n95AKbOrH2/KXt/YFF0tS+0Gh46ArG6qk8tnSq38lckWqmOIfCJxeN4KBPdCE4ha7fC+ 8QrAm6KeJtERLqnxoiNvGVBYwC+c23ZDOAxcvqJiT3mHXMPX8yQ5f2AHHkULZy5WknyB 9UFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qNAk/p1h"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54742-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54742-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUHiJAvMeN3kPRaV915PhsbERB55tuKsxfuh/UcliNfvt2KqgefACatzJHmjk3XzK6HfFnyoOiyg31SBfvL+nIUCJZSwg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id iz14-20020a170902ef8e00b001d93b220500si1512295plb.97.2024.02.06.03.19.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:19:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54742-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qNAk/p1h"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54742-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54742-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2435128602F for ; Tue, 6 Feb 2024 11:08:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0B69130E53; Tue, 6 Feb 2024 11:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qNAk/p1h" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E658012FF81; Tue, 6 Feb 2024 11:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217561; cv=none; b=aFvfGrrHIDiuprtLGP7Nv4ha/lz1TkLxdVxhFzL2sYzFeNQvHmXk+qG9GtQed4Vyl+eDnK8PRi2+a8NodyiZNFmTHyoT2iQY1Nczk0sYE+lJndn5075GhCMF0pBjmOHObNvadiMfBzu9ge2IvRZLhvzbcRyjmfIagv3w8Op8gtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217561; c=relaxed/simple; bh=cQILpcsc6/caTGhPuQvyIMhE5e7gEUIcuJuq7dS5DzU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uLYTYQYqMfBKZsz3gdhmpp9nnQY8JYPlMyyWI5eAGxC0aByAXmstW08eFMsMJ5w84+QBAIUVlJzXiLKxR7SmJGdwz1RrBiOXQ3HxFpu/J7fFB+vwuebZ7fzjQUUD0ry2RlHnQ/0hOm9T/Yy0WPbxk5yN1eJSW0pZbxsPgJXCPag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qNAk/p1h; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5329C43601; Tue, 6 Feb 2024 11:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217560; bh=cQILpcsc6/caTGhPuQvyIMhE5e7gEUIcuJuq7dS5DzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qNAk/p1hqgs2qNxzkK+RBgTpAM/VFwbYgtnM1c9lb2Q0rHMldJ//ypQTGqDSsrpN7 LKIkesoHrymKbLwrTuySqv5SFslmDqjKFSxqAPjtj5yYwjb9+5OcPgASS+DzKrfUzz IiVFuT035jqlqg/ODAxaQz0L9qJsWNkb5zISWh5XD5MCTy0PF8IKAyA0GirkYmKTZj 5Tr5aOmH+/n6sf2CfSH971A+AI8VKXVon6ulwAiCiCh0xw5ID4XBOeSMHdCdR9b0Rq M/RGvSjW2/M6ZBybWKK9tYvmnM1BmqBHRcCKCc3sJt8uzO70UA02Dch37aIpTskk6b NGBxluCDET6/g== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 6/6] tools/rv: Fix curr_reactor uninitialized variable Date: Tue, 6 Feb 2024 12:05:34 +0100 Message-ID: <3a35551149e5ee0cb0950035afcb8082c3b5d05b.1707217097.git.bristot@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790148191648787239 X-GMAIL-MSGID: 1790148191648787239 clang is reporting: $ make HOSTCC=clang CC=clang LLVM_IAS=1 clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -I include -c -o src/in_kernel.o src/in_kernel.c [...] src/in_kernel.c:227:6: warning: variable 'curr_reactor' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] 227 | if (!end) | ^~~~ src/in_kernel.c:242:9: note: uninitialized use occurs here 242 | return curr_reactor; | ^~~~~~~~~~~~ src/in_kernel.c:227:2: note: remove the 'if' if its condition is always false 227 | if (!end) | ^~~~~~~~~ 228 | goto out_free; | ~~~~~~~~~~~~~ src/in_kernel.c:221:6: warning: variable 'curr_reactor' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] 221 | if (!start) | ^~~~~~ src/in_kernel.c:242:9: note: uninitialized use occurs here 242 | return curr_reactor; | ^~~~~~~~~~~~ src/in_kernel.c:221:2: note: remove the 'if' if its condition is always false 221 | if (!start) | ^~~~~~~~~~~ 222 | goto out_free; | ~~~~~~~~~~~~~ src/in_kernel.c:215:20: note: initialize the variable 'curr_reactor' to silence this warning 215 | char *curr_reactor; | ^ | = NULL 2 warnings generated. Which is correct. Setting curr_reactor to NULL avoids the problem. Cc: stable@vger.kernel.org Fixes: 6d60f89691fc ("tools/rv: Add in-kernel monitor interface") Signed-off-by: Daniel Bristot de Oliveira --- tools/verification/rv/src/in_kernel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c index ad28582bcf2b..f04479ecc96c 100644 --- a/tools/verification/rv/src/in_kernel.c +++ b/tools/verification/rv/src/in_kernel.c @@ -210,9 +210,9 @@ static char *ikm_read_reactor(char *monitor_name) static char *ikm_get_current_reactor(char *monitor_name) { char *reactors = ikm_read_reactor(monitor_name); + char *curr_reactor = NULL; char *start; char *end; - char *curr_reactor; if (!reactors) return NULL;