Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: rfkill: Replace strcpy with memcpy to improve rfkill_alloc
Date: Thu, 08 Jan 2026 13:29:17 +0100	[thread overview]
Message-ID: <6983492c92a811b45c27bc36337e16fbd1abd94f.camel@sipsolutions.net> (raw)
In-Reply-To: <20251215122036.379322-2-thorsten.blum@linux.dev>

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

  reply	other threads:[~2026-01-08 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 12:20 [PATCH net-next] net: rfkill: Replace strcpy with memcpy to improve rfkill_alloc Thorsten Blum
2026-01-08 12:29 ` Johannes Berg [this message]
2026-02-20 17:00   ` Thorsten Blum

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=6983492c92a811b45c27bc36337e16fbd1abd94f.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=thorsten.blum@linux.dev \
    /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