Re: include/linux/thread_info.h:259:25: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small

From: Arnd Bergmann
Date: Tue Feb 18 2025 - 01:05:01 EST


On Tue, Feb 18, 2025, at 03:44, Oliver Sang wrote:
> On Fri, Feb 14, 2025 at 12:22:33PM +0100, Arnd Bergmann wrote:
>> On Fri, Feb 14, 2025, at 09:44, Philip Li wrote:
>> > On Mon, Feb 10, 2025 at 02:39:46PM -0600, Elizabeth Figura wrote:
>>
>> Maybe the change below would address it? (Not sure I handled the
>> "+1" right here, but something like that should make it obvious
>> to the compiler what the check is).
>
> yes, below change fixed the build error we reported. thanks
>
> Tested-by: kernel test robot <oliver.sang@xxxxxxxxx>

Thanks for testing!

Elizabeth, can you turn this into a proper patch with
"Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>"? I assume
you'll want to make some slight changes to ensure it's
both readable and correct, but apparently calculating
the size in bytes and do both the range checking and
the copy based on that is what makes gcc see the limit
correctly.

Arnd