[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <35EF1145-7214-4B51-8168-4D54028BE0E5@linux.dev>
Date: Tue, 25 Feb 2025 20:17:33 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Ingo Molnar <mingo@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/mtrr: Remove unnecessary strlen() in mtrr_write()
On 25. Feb 2025, at 14:35, Ingo Molnar wrote:
> * Thorsten Blum <thorsten.blum@...ux.dev> wrote:
>
>> The local variable length already holds the string length after calling
>> strncpy_from_user(). Using another local variable linlen and calling
>> strlen() is therefore unnecessary and can be removed. Remove linlen
>> and strlen() and use length instead.
>>
>> Compile-tested only.
>>
>> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
>> ---
>
> I see no corner-case analysis in the changelog about what may happen if
> the copy fails partially.
Hi Ingo,
I'm not sure what you mean. Why would I describe something I didn't
change? This patch only removes an unnecessary string (line) length
calculation and shouldn't affect the logic in any way.
If strncpy_from_user() fails, we immediately return length from
mtrr_write(), but my patch doesn't change this - unless I'm missing
something?
Thanks,
Thorsten
Powered by blists - more mailing lists