From patchwork Mon Oct 24 11:29:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417055wru; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5U4iEL7sFd0zOKnkpdsxKdzcYKu3lmHBa1d/bPnZuLibPGsMO17SdntkptvJS1kKgNxjO3 X-Received: by 2002:a05:6a00:234d:b0:561:f0c3:cde1 with SMTP id j13-20020a056a00234d00b00561f0c3cde1mr33340510pfj.34.1666613553674; Mon, 24 Oct 2022 05:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613553; cv=none; d=google.com; s=arc-20160816; b=ECFPOIbgkyILOh6CQiF3d6nrGesO3sWZWsaVZ+A+GVBRqLoQL9LFWE8k8c8sfeBSTM Go+BFPmX/8vw66jwf/JYFfgnT7JjPh0tWqlTJhMkNCzU8OhmRsh1knB12YxWtjDSs+4W L22Tn9SCWqwPlwF1j8qEgSdT5XcN/Y6VAYmv6v62kqu9mpqsL4UHPn3xHl38T0uYmDqr 8kO9Fwv+0iDaTAd67A3XhyrXY7S+4OP8H3tLlFdceTCPdVyT9hUnn+NJMc+mfKWJfBKA 02hNkbvCyS6KzeSa2qy8Eg5KcITbczapzisvSrcEGHPnGONXZFAMjYvN+D8OEOnwrcYT Uqug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y5yHALwoKnh4Om2eOF003SEYMGpg5VhD5QMcTpB+TLI=; b=pfDHWnbBE0UtBE3V49fYPXy+6cnH4E0sfXFksU+j5RnnnnBmUSdY7oBby28qgePcAT 2rST6+dInX6WQAyBXFfX3Bi7lOMSe6U+4NaiPNBXJvWZovU9q2raJwp9Hx1xAYYeLNCW 92K3ebanyDI0UOehHlNIMlvgYJ3+JgxIfCWd/wmwlg0xhXcyBe+URU2sOI4S31XfJxxp 8/ln1+k4XXd7BHThLyszOPAdo819V8MqpfJpJm+0P5uU16z3IrYTz0krXAsnrc+bHDVO o+3nwhb8NvObJIxkN4gY8vYiNOszELNHCeqz+CA3rImg6fCRVCryYRbe/Ih0+rn4K5uk gCGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LN8WMaNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s138-20020a632c90000000b0044db77667ebsi34832165pgs.3.2022.10.24.05.12.20; Mon, 24 Oct 2022 05:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LN8WMaNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232484AbiJXMBi (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232543AbiJXL7P (ORCPT ); Mon, 24 Oct 2022 07:59:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6073E7C1E8; Mon, 24 Oct 2022 04:48:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF9A36128E; Mon, 24 Oct 2022 11:47:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFAD6C433C1; Mon, 24 Oct 2022 11:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612078; bh=PXpipTnBrRLPqsNN64DZFWvxTM737PnWfsW5sg9ZY+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LN8WMaNCCi7KFXAY/V1XaiaHhofeOI8JAxLDenexJp5QR4qZzXCr/1RC8zChm3otJ uyIZDcy8MkHosRqwD1UuVZCB2rCt0YwjaUJxzFnGdUPVs3Ivx4hcgHKnrVw4zNHG1E ms7U0rFsvMIawf+Yowi8cfl/MKHKD6b8lR2Mf5IY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd , Bjorn Andersson , Andrew Chernyakov Subject: [PATCH 4.14 034/210] rpmsg: qcom: glink: replace strncpy() with strscpy_pad() Date: Mon, 24 Oct 2022 13:29:11 +0200 Message-Id: <20221024112958.072393418@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570973412898299?= X-GMAIL-MSGID: =?utf-8?q?1747570973412898299?= From: Krzysztof Kozlowski commit 766279a8f85df32345dbda03b102ca1ee3d5ddea upstream. The use of strncpy() is considered deprecated for NUL-terminated strings[1]. Replace strncpy() with strscpy_pad(), to keep existing pad-behavior of strncpy, similarly to commit 08de420a8014 ("rpmsg: glink: Replace strncpy() with strscpy_pad()"). This fixes W=1 warning: In function ‘qcom_glink_rx_close’, inlined from ‘qcom_glink_work’ at ../drivers/rpmsg/qcom_glink_native.c:1638:4: drivers/rpmsg/qcom_glink_native.c:1549:17: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation] 1549 | strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings Signed-off-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220519073330.7187-1-krzysztof.kozlowski@linaro.org Signed-off-by: Andrew Chernyakov Signed-off-by: Greg Kroah-Hartman --- drivers/rpmsg/qcom_glink_native.c | 2 +- drivers/rpmsg/qcom_smd.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1447,7 +1447,7 @@ static void qcom_glink_rx_close(struct q cancel_work_sync(&channel->intent_work); if (channel->rpdev) { - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = RPMSG_ADDR_ANY; --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -1000,7 +1000,7 @@ static int qcom_smd_create_device(struct /* Assign public information to the rpmsg_device */ rpdev = &qsdev->rpdev; - strncpy(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); + strscpy_pad(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); rpdev->src = RPMSG_ADDR_ANY; rpdev->dst = RPMSG_ADDR_ANY; @@ -1230,7 +1230,7 @@ static void qcom_channel_state_worker(st spin_unlock_irqrestore(&edge->channels_lock, flags); - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = RPMSG_ADDR_ANY; rpmsg_unregister_device(&edge->dev, &chinfo);