From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F7B73EBF10 for ; Fri, 20 Feb 2026 17:00:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771606807; cv=none; b=LenNli2n/r/jU1WADuVLldyDOLt67e5thlgYtLa+Q0wDoPHHTUkasmQfxJ4NSWP4J1sK0IgYOlK+QEtiiLdttKb3xQ4Nm3Fk3qKOHFWpBSDtXbU3JH3sNGsaxm3L0TWJKINHO9L4pzTgEHmlCE/mbxvH84gWfoi2z/MuP3jikro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771606807; c=relaxed/simple; bh=2OxFsATCItBc+22+SD2qdAlW/PLhtqwfva1j4C1fMYg=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=D69HsMqZa0G9bWdxQ1vsYf9+mv9ReqEhjYwotjm89fzBBk/SvvVq6bKLo1cyPA78y5wyQfguGgQbVTsx3wjnUaYLp03TOOMsRCI/9677OmzI5Fhpd+hTymkfdZkxZkmRhvKPSvl/xZT8JusBoHE7Egw5oMp9hWRfAdXcttFdFfQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=C5gQBEkj; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="C5gQBEkj" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1771606803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lsz36afj9Yf9FxTFLOgJtL8vxZ6vXJj8n/cdSlWhQJ0=; b=C5gQBEkjQWWlrxSNARi1HEYNd77sdWyoA1+6kAibTVptY+obzOZtU3fMeCSBuQGE/pG5JX bkshYuXPJZ1sQGM0hD1doYfZn5Col9pf3hHXdAiRrYUV8AFKimCTY70/nATFGfUDyIVoUu ZBeseCsdGrmOgp6zMQqbWt4n0OyExG8= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81.1.4\)) Subject: Re: [PATCH net-next] net: rfkill: Replace strcpy with memcpy to improve rfkill_alloc X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum In-Reply-To: <6983492c92a811b45c27bc36337e16fbd1abd94f.camel@sipsolutions.net> Date: Fri, 20 Feb 2026 18:00:00 +0100 Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: <86C8A63A-E72F-48C9-A1C0-4E65A91CA987@linux.dev> References: <20251215122036.379322-2-thorsten.blum@linux.dev> <6983492c92a811b45c27bc36337e16fbd1abd94f.camel@sipsolutions.net> To: Johannes Berg X-Migadu-Flow: FLOW_OUT On 8. Jan 2026, at 13:29, Johannes Berg wrote: > 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"... Yes, this is primarily a refactoring to avoid deprecated strcpy(), and to harden the code by using struct_size(). Thanks, Thorsten