From patchwork Thu Aug 18 21:01:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 12947904 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7010C00140 for ; Thu, 18 Aug 2022 21:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=M7QtTUwOBUQL6F+Nxh5JQydKpal58O9Bou44tGjptM4=; b=mQqC1pfKATTas1 U5+72Jgh8ilE1pxcRDe/LfRHdo+cnlyZ3ZLQt8wmgRLvLa9tEzRlEJ1xaJHpuJvD03lPcIYdZnKkJ yrgTKQ+gWlzhVkVlw7aRlR9qonIg8Q80xzjcUteb5YgN7G4pdWlrQvQgGOZd2aRZQJVh/2DfQVIjW a1EptXsraZAHwh+MSaWJ/vDeeagsqeaNy3jedeQRJATZyeu4/4kMxuAa2f6a6UxIEYEB13A9yg5t/ ldYihPooJ5DCH9DdCa1oHp9hfe67p6apx/Aehk5Pyuep3VgOqBImd/4lgiQorXvasdvlrPA1Pa3Yz EkMSe78Iha2kJUN9DNxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOmfJ-009bW1-Ih; Thu, 18 Aug 2022 21:02:57 +0000 Received: from www.zeus03.de ([194.117.254.33] helo=mail.zeus03.de) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOmfC-009bRx-JF for linux-arm-kernel@lists.infradead.org; Thu, 18 Aug 2022 21:02:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=k1; bh=B3m/xuzWYlZO9505wbaZ6suOtie tmTguhBShSHJbFfA=; b=L1HL/xfCrrumc/6gVa8z7U4MI/IqPEmJlDM9kwI7ASm dPs58deFxXDcobf0alNTA3IPRuAD1gT6mpw59embYAn5sGkhaw7xdduHS+/0BlwC rcyrZPTBqJZImSwQgSBMDeyV06xVpdmz4VFZteARwWQcwyW5+WuVnEfKn8lOblEQ = Received: (qmail 3961428 invoked from network); 18 Aug 2022 23:01:07 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 18 Aug 2022 23:01:07 +0200 X-UD-Smtp-Session: l3s3148p1@buO0R4rmAMsucref From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Qiang Zhao , Li Yang , Andy Gross , Bjorn Andersson , Konrad Dybcio , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [PATCH] soc: move from strlcpy with unused retval to strscpy Date: Thu, 18 Aug 2022 23:01:06 +0200 Message-Id: <20220818210106.7349-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220818_140251_015246_9A8FC7DF X-CRM114-Status: GOOD ( 11.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang Acked-by: Bjorn Andersson --- drivers/soc/fsl/qe/qe.c | 4 ++-- drivers/soc/qcom/smp2p.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index b3c226eb5292..58746e570d14 100644 --- a/drivers/soc/fsl/qe/qe.c +++ b/drivers/soc/fsl/qe/qe.c @@ -524,7 +524,7 @@ int qe_upload_firmware(const struct qe_firmware *firmware) * saved microcode information and put in the new. */ memset(&qe_firmware_info, 0, sizeof(qe_firmware_info)); - strlcpy(qe_firmware_info.id, firmware->id, sizeof(qe_firmware_info.id)); + strscpy(qe_firmware_info.id, firmware->id, sizeof(qe_firmware_info.id)); qe_firmware_info.extended_modes = be64_to_cpu(firmware->extended_modes); memcpy(qe_firmware_info.vtraps, firmware->vtraps, sizeof(firmware->vtraps)); @@ -599,7 +599,7 @@ struct qe_firmware_info *qe_get_firmware_info(void) /* Copy the data into qe_firmware_info*/ sprop = of_get_property(fw, "id", NULL); if (sprop) - strlcpy(qe_firmware_info.id, sprop, + strscpy(qe_firmware_info.id, sprop, sizeof(qe_firmware_info.id)); of_property_read_u64(fw, "extended-modes", diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c index d9c28a8a7cbf..e9c8030d50ee 100644 --- a/drivers/soc/qcom/smp2p.c +++ b/drivers/soc/qcom/smp2p.c @@ -422,7 +422,7 @@ static int qcom_smp2p_outbound_entry(struct qcom_smp2p *smp2p, char buf[SMP2P_MAX_ENTRY_NAME] = {}; /* Allocate an entry from the smem item */ - strlcpy(buf, entry->name, SMP2P_MAX_ENTRY_NAME); + strscpy(buf, entry->name, SMP2P_MAX_ENTRY_NAME); memcpy(out->entries[out->valid_entries].name, buf, SMP2P_MAX_ENTRY_NAME); /* Make the logical entry reference the physical value */