[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6983492c92a811b45c27bc36337e16fbd1abd94f.camel@sipsolutions.net>
Date: Thu, 08 Jan 2026 13:29:17 +0100
From: Johannes Berg <johannes@...solutions.net>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net: rfkill: Replace strcpy with memcpy to
improve rfkill_alloc
On Mon, 2025-12-15 at 13:20 +0100, Thorsten Blum wrote:
> strcpy() is deprecated [1] and uses an additional strlen() internally;
> use memcpy() directly since we already know the length of 'name' and
> that it is guaranteed to be NUL-terminated.
>
> Use struct_size(), which provides additional compile-time checks for
> structures with flexible array members (e.g., __must_be_array()), to
> determine the allocation size for a new 'struct rfkill'.
TBH, I don't really see that this is a real _improvement_. I guess I'll
take it if you sell it as "let's not use deprecated strcpy" instead,
although even the documentation says "no new uses"...
johannes
Powered by blists - more mailing lists