From: Shuah Khan <skhan@linuxfoundation.org>
To: Borislav Petkov <bp@alien8.de>
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>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH 1/4] tools/power/cpupower: Read energy_perf_bias from sysfs
Date: Thu, 29 Oct 2020 15:38:43 -0600 [thread overview]
Message-ID: <ca53e90a-f4eb-5007-a137-62729e3d74f0@linuxfoundation.org> (raw)
In-Reply-To: <20201016083754.GB8483@zn.tnic>
On 10/16/20 2:37 AM, Borislav Petkov wrote:
> On Thu, Oct 15, 2020 at 11:49:32AM -0600, Shuah Khan wrote:
>> Is there a reason to move "int fd"?
>
Sorry for a late response.
Okay. Looked odd since it didn't need changing.
> 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?
Right. It will be great if you can add filename to the message.
>
>> 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?
>
All of the other ones should be changed as such. Why add more?
thanks,
-- Shuah
next prev parent reply other threads:[~2020-10-29 21: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
2020-10-29 21:38 ` Shuah Khan [this message]
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=ca53e90a-f4eb-5007-a137-62729e3d74f0@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=bp@alien8.de \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=shuah@kernel.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