From: Namhyung Kim <namhyung@kernel.org>
To: Michal Suchanek <msuchanek@suse.de>
Cc: linux-perf-users@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Thomas Richter <tmricht@linux.ibm.com>,
linux-kernel@vger.kernel.org, Tony Jones <tonyj@suse.de>
Subject: Re: [PATCH] perf hwmon_pmu: Fix uninitialized variable warning
Date: Thu, 23 Oct 2025 14:50:43 -0700 [thread overview]
Message-ID: <aPqjMzxyYeKCp91K@google.com> (raw)
In-Reply-To: <20251022103839.19550-1-msuchanek@suse.de>
Hello,
On Wed, Oct 22, 2025 at 12:38:35PM +0200, Michal Suchanek wrote:
> The line_len is only set on success. Check the return value instead.
Can you please share the actual warning messages from the compiler?
Thanks,
Namhyung
>
> Fixes: 53cc0b351ec9 ("perf hwmon_pmu: Add a tool PMU exposing events from hwmon in sysfs")
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
> tools/perf/util/hwmon_pmu.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/hwmon_pmu.c b/tools/perf/util/hwmon_pmu.c
> index 416dfea9ffff..5c27256a220a 100644
> --- a/tools/perf/util/hwmon_pmu.c
> +++ b/tools/perf/util/hwmon_pmu.c
> @@ -742,8 +742,7 @@ int perf_pmus__read_hwmon_pmus(struct list_head *pmus)
> continue;
> }
> io__init(&io, name_fd, buf2, sizeof(buf2));
> - io__getline(&io, &line, &line_len);
> - if (line_len > 0 && line[line_len - 1] == '\n')
> + if (io__getline(&io, &line, &line_len) > 0 && line[line_len - 1] == '\n')
> line[line_len - 1] = '\0';
> hwmon_pmu__new(pmus, buf, class_hwmon_ent->d_name, line);
> close(name_fd);
> --
> 2.51.0
>
next prev parent reply other threads:[~2025-10-23 21:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 10:38 [PATCH] perf hwmon_pmu: Fix uninitialized variable warning Michal Suchanek
2025-10-23 21:50 ` Namhyung Kim [this message]
2025-10-23 22:11 ` Tony Jones
2025-10-24 2:10 ` Namhyung Kim
2025-10-30 3:46 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aPqjMzxyYeKCp91K@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=msuchanek@suse.de \
--cc=peterz@infradead.org \
--cc=tmricht@linux.ibm.com \
--cc=tonyj@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.