From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (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 69D7F3ACF00 for ; Sun, 10 May 2026 16:11:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778429485; cv=none; b=mC1xq8pQe8XAtkOizgNZxqgrK8X814zWTEN4BBKbMwZ16tyolAbYvQnEQGx+F2ac5WW2HiqquIOWu9s0wwcLyKMUITc2bJmLxJ+RZuSy+DPXbeWPKhC+KJcZ1ofdZdbEI5Rs6tyRzSSD474boTAzfipJJ5fp634cb5vRB0kMlRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778429485; c=relaxed/simple; bh=VpyAswRNrKpzlIHyzQ9ryez1EEih2VW31tPTZt5Y6Ks=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=j01LRyCymAor2tkvuRpLoe/iJns9jWv54ttrZ5PXE0nfbAzruMxTpGa0Ph8Qk62e+MA7VYmPeuPvu2uM1unH+uE9ws7C6MaxfBX2OP9DvqiiiA+HrTQTD72jhJbAiSq03iNy652Idom8kr408SqS8ycu0kWhFKl0IboQwlHTXdo= 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=cW3/pW3g; arc=none smtp.client-ip=91.218.175.178 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="cW3/pW3g" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778429479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=B5O2D0CT4paGTJSdYTWUHa8jV0uQ6X+6YdoC97f8yJc=; b=cW3/pW3gYHc3bm4wbc/koM0NzKgdf+kqJbzJNlp+WZ5Q3LGkTmbyQEQl/2V2ZXHMznm6uj emJBupdXoIeuEaj9KA10YYIMCKKQSPTb9Kj7WFF+nloFb1A9b3Xf9GCDjhn2V2m862QWg9 uqEwvMaJzMPwc6fNfHauOBanIZ0IqmY= From: Thorsten Blum To: Rich Felker , John Paul Adrian Glaubitz Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, Thorsten Blum Subject: [PATCH] sh: dma: use strscpy in register_dmac Date: Sun, 10 May 2026 18:10:14 +0200 Message-ID: <20260510161012.108731-4-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=983; i=thorsten.blum@linux.dev; h=from:subject; bh=EDeF8BLm2ABpziHqAng8eLQUqCfqSBG4zcHuaKEioOU=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFkMa5/4RanGms7Z/lTMne8hZ1rc4ikb3zNNZ+V//C8n9 fri0P1+HaUsDGJcDLJiiiwPZv2Y4VtaU7nJJGInzBxWJpAhDFycAjAR6WSG/7HXWKfemCLrzrnE av9b0c+XLLon38mY7li8vizR3PSQ2EmG/3FvE1atiT3onqxffeubc0ggW/br5aceTj/CX3VATqz xPBcA X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Replace memcpy() and the hard-coded string length with strscpy() to improve register_dmac(). Signed-off-by: Thorsten Blum --- arch/sh/drivers/dma/dma-api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c index 87e5a8928873..31b614358270 100644 --- a/arch/sh/drivers/dma/dma-api.c +++ b/arch/sh/drivers/dma/dma-api.c @@ -16,6 +16,7 @@ #include #include #include +#include #include DEFINE_SPINLOCK(dma_spin_lock); @@ -232,7 +233,7 @@ int register_dmac(struct dma_info *info) chan->chan = info->first_channel_nr + i; chan->vchan = info->first_channel_nr + i + total_channels; - memcpy(chan->dev_id, "Unused", 7); + strscpy(chan->dev_id, "Unused"); if (info->flags & DMAC_CHANNELS_TEI_CAPABLE) chan->flags |= DMA_TEI_CAPABLE;