From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 5EBE445A2AA for ; Fri, 14 Aug 2026 12:26:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786710390; cv=none; b=pgPiDdm6jhtUptcjESqjf+61Z6Esh1A5Fff/jzIa/9ahL3mOAZW5Irqq1bp+IXbADApAhzR1nFhwH2c6m79z3UqoLwlssF2FbLTyfyIEG4w1zBCkL6euBRNIPXH0Y4fdLa/qLDp9h6il6gbEgXxXChK81Qk7A52D40VI1xyZhik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786710390; c=relaxed/simple; bh=i+MFw9i/BWYvIkff7MZE6HGkCDfiMX/ki6wJATwtoW8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GbPv799OHcm34NGhRMZR+y65eiqFFSR/5Lkg7iZg+xdZAE2JwJbQLEj3JbfRuwXHkmCenGZpFKuESKZ7HhX+fAksoEhvxfYDqMyjH+JBt3g5hUAxQIilQOGRXff2fMNMMkTAwvDQeSq5aIktChhNe7VepUR/N4SU9hDNWaEOpbY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SHeaLYoJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SHeaLYoJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F8281F000E9; Fri, 14 Aug 2026 12:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786710389; bh=WsuzZNbDDD5GlpZTXjbJXIZcsLrcg0Qg6ozbSmysyEY=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=SHeaLYoJmKpjt0OmPYZNTHbZuMRCaE+WtPi+PYrmT3EF/VlwgEDPxbGkDa7TaKK9e Zxkwede1YyuzDDDU2YEt7FnO66W7uk+5QsENO/x4GvmQhSMrMDD8A2iTYiH+DPi7kf FYt738KqfRAxmPR9SMyC8FJ+GcWYZfVvXz8W0AxLizXbsidZSekAzI6bJ73BnMP2UY Gzs3mlXI7OKn4fyciWsZ/9xnOIOBaKanB1dMFqGuD79ryNHrBOJBfeb3fwFC8a+0Kw oHFi15Jo87O2b0ZJn7o4xTz8ys8YA2056J0kgptkf2Z8dl0IevmKWLGC2SZaejtUOT Me2is6eqZYogw== Message-ID: <44f93c64-55e9-4240-bc2c-be49280219f9@kernel.org> Date: Fri, 14 Aug 2026 14:26:24 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] powerpc: fsl_rio: Use snprintf() in fsl_rio_setup() To: Thorsten Blum , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Kees Cook Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20260630144951.692473-2-thorsten.blum@linux.dev> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: <20260630144951.692473-2-thorsten.blum@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 30/06/2026 à 16:49, Thorsten Blum a écrit : > While the current code works correctly, replace the unbounded sprintf() > with the safer snprintf() in fsl_rio_setup() to follow secure coding > best practices. > > Signed-off-by: Thorsten Blum > --- > arch/powerpc/sysdev/fsl_rio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c > index eb55dabb4748..077c03cd93e4 100644 > --- a/arch/powerpc/sysdev/fsl_rio.c > +++ b/arch/powerpc/sysdev/fsl_rio.c > @@ -612,7 +612,7 @@ static int fsl_rio_setup(struct platform_device *dev) > kfree(port); > continue; > } > - sprintf(port->name, "RIO mport %d", i); > + snprintf(port->name, sizeof(port->name), "RIO mport %d", i); Are you sure it is correct ? Shouldn't it be sizeof(port->name) - 1 ? > > priv->dev = &dev->dev; > port->dev.parent = &dev->dev;