From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 24AFF2D46BB for ; Wed, 13 Aug 2025 09:33:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755077629; cv=none; b=UH0VA2q1IeedVgFqRz6o6HrB2NjonuQrMAgek6mdkAAwarVYTvzO26jXHpet0oBvmZ6pvEJObfqEPilNA9JhTehUYhZ+SldytFvbsfqGcrGNkVeJYTaZF6uMgXanS/MWZCw9X/bXHX+nt0Bxmiw3gIBt22Am2s4VrFRaiMuqBxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755077629; c=relaxed/simple; bh=eBledXq1IgU3Oseqe5FTx74iAqZSm6cqot/95aBsh7k=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=dNLg3q6i9zwAT5g8hLeQ3okAUcL/N5RjoibgG1FNtsMUFkYtMFM9hXb0d8xipy9voVlQefhmhM1+qGCVXXRxqfffLypAPyXoyt0fXB/WxuZZ2/99x5WK9MZt0lTZ2XFdIgBuvkKHUUiQB+Z83JZAMfV7iTXzaDuNEQqFj3Rcjes= 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=h9ouHArw; arc=none smtp.client-ip=95.215.58.186 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="h9ouHArw" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1755077615; 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=eBledXq1IgU3Oseqe5FTx74iAqZSm6cqot/95aBsh7k=; b=h9ouHArwwwnH6/Js/k70gvN7pO3qvsXGRbzh/OSSkpEVbNEl/av0wucP9k00wWJofIZF72 NkxKWe2AVd1POVKkxzpunho7CbMfoSgersp21Cm2HuD3h+c3kAKxl9MzvR/1vqKusGDiHq ErYquQEJZfJWKSzDELjxZNHULY9ziNg= 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\)) Subject: Re: [PATCH] params: Replace deprecated strcpy() with strscpy() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum In-Reply-To: <5d334a1f-0dbd-4e25-bbc5-b01aca369385@suse.com> Date: Wed, 13 Aug 2025 11:33:18 +0200 Cc: =?utf-8?Q?Thomas_Wei=C3=9Fschuh?= , Shyam Saini , Luis Chamberlain , Dmitry Antipov , linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: <20250810214456.2236-1-thorsten.blum@linux.dev> <5d334a1f-0dbd-4e25-bbc5-b01aca369385@suse.com> To: Petr Pavlu X-Migadu-Flow: FLOW_OUT Hi Petr, On 13. Aug 2025, at 10:59, Petr Pavlu wrote: > Since the code already calculated the length of val and that it fits > into kps->string, is there any advantage (or disadvantage) to using > strscpy() over memcpy()? strscpy() guarantees that the destination buffer 'kps->string' is always NUL-terminated, even if the source 'val' is not. memcpy() just copies the bytes as they are. If it were guaranteed that 'val' is always NUL-terminated, memcpy() would be fine too, but since param_set_copystring() is exported, we probably can't make that assumption. > I think this can go through the modules tree. I've CC'd the mailing > list. Thanks, Thorsten