public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: X86 ML <x86@kernel.org>, Thomas Renninger <trenn@suse.com>,
	Shuah Khan <shuah@kernel.org>, Len Brown <lenb@kernel.org>,
	linux-pm@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] tools/power/cpupower: Read energy_perf_bias from sysfs
Date: Fri, 16 Oct 2020 10:37:54 +0200	[thread overview]
Message-ID: <20201016083754.GB8483@zn.tnic> (raw)
In-Reply-To: <7806e3c0-f435-18a0-c50d-eee3f1f7fccf@linuxfoundation.org>

On Thu, Oct 15, 2020 at 11:49:32AM -0600, Shuah Khan wrote:
> Is there a reason to move "int fd"?

Habit from tip - we sort function-local variables in a reverse fir tree
order. And since I'm adding cpupower_write_sysfs(), I made them look
consistent.

> > +	numwritten = write(fd, buf, buflen - 1);
> > +	if (numwritten < 1) {
> > +		perror("write failed");
> 
> Please add filename to the error message

	perror(path);

or do you want me to build a string with an error message and filename?

> Please add return check for snprintf, please add a define for
> "cpu%u/power/energy_perf_bias" since it is hardcoded in
> read/write functions.

None of the other snprintf() calls in cpupower do that. Nothing checks
snprintf() retval and the last part of the sysfs path is a naked string.

Why is this different?

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2020-10-16  8:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 14:45 [PATCH 0/4] x86: Remove direct use of MSR_IA32_ENERGY_PERF_BIAS Borislav Petkov
2020-10-15 14:46 ` [PATCH 1/4] tools/power/cpupower: Read energy_perf_bias from sysfs Borislav Petkov
2020-10-15 17:49   ` Shuah Khan
2020-10-16  8:37     ` Borislav Petkov [this message]
2020-10-29 21:38       ` Shuah Khan
2020-10-29 21:59         ` Borislav Petkov
2020-10-29 22:32           ` Shuah Khan
2020-10-29 23:11             ` Borislav Petkov
2020-11-02 11:52             ` Borislav Petkov
2020-10-15 14:46 ` [PATCH 2/4] tools/power/turbostat: " Borislav Petkov
2020-10-15 14:46 ` [PATCH 3/4] tools/power/x86_energy_perf_policy: " Borislav Petkov
2020-10-15 14:46 ` [PATCH 4/4] x86/msr: Do not allow writes to MSR_IA32_ENERGY_PERF_BIAS Borislav Petkov

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=20201016083754.GB8483@zn.tnic \
    --to=bp@alien8.de \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=trenn@suse.com \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox