From patchwork Mon Oct 24 11:28:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422194wru; Mon, 24 Oct 2022 05:22:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5BOHzvElw+dIldUznzpbn4G2qWChGqK+R/g2mHNz47DZnJtshzeZsWJtlu6nB6bzUHOYt+ X-Received: by 2002:a05:6402:524e:b0:461:fa05:aff8 with SMTP id t14-20020a056402524e00b00461fa05aff8mr419348edd.283.1666614124910; Mon, 24 Oct 2022 05:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614124; cv=none; d=google.com; s=arc-20160816; b=qBa7yvoWoqzE0O6u6hFZ6JhvndsRS4tNXb6q3cpobD63FYCyPVC+LbObNDhqw0dvHL 5v9jaSQYll4X3hZscMw30sVjfWNap6MJJpQckA2sF7MWbxW7s2uExeYTWHSampBOn87v ZDtx2qKsjrpQe9jBnIR2ySvbtTAeVaQpSq6+1go8SzBIwV2Twrjke9aV0gmx5Y4uYo5a PuDLVLN38Pr40DYimg2BOOExztlSlgiWNNVC8nKgoVdo1B87wi2Gdweu5tcllpva31Dc UsDLiRYjLVP+60ZE1aXFJRUr3/Laybs7lGT22uQdDoCK2hrWjTZZJ6bNkYZHzO7yj4u6 fSCw== 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=Pk89Ne7J7uv4B7cRzuJ+HfQoXxeNskDzRj2up5O6c7E=; b=FH5cYsoR/+KOdCZtHv9BMJECZCYSEhfhuVFhYxDCM8JhYue6dNvGA/QZVMJge/yWDB /ZVxlq8yA59GrrmbUE3BsHeRioyX5VR1RHH/JZYdO7uwxc5juUWIhkL56vscNRFw7eZK VD5hfsHiuPC5nU11qmwZlbUgtwqCgBof3uLQnSJf4yEu0pFKZTy3zssy2my5cPWjhKvO ycbfwkpprxPJE9lMw9GRuRhxF8VbgxvYB5LZlqhgonEmz0DkP5urdN+pVOkvEBwUUwot 7B5px5vBdI3Iy7Y5BTQ65Ged3RE1nCqW8c3k1l6tjFTZTACFG5bPbNoyPJ6nGvDNJl/1 GDaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sQ6YD/5/"; 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 q22-20020a170906771600b0078da3218b54si26659366ejm.171.2022.10.24.05.21.41; Mon, 24 Oct 2022 05:22:04 -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="sQ6YD/5/"; 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 S233158AbiJXMQx (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233400AbiJXMPB (ORCPT ); Mon, 24 Oct 2022 08:15:01 -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 08EDC7962F; Mon, 24 Oct 2022 04:55:46 -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 8A60061252; Mon, 24 Oct 2022 11:55:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A062EC433D6; Mon, 24 Oct 2022 11:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612537; bh=Nrjzs/H2egeDQFrckuWu56rSL09kwzfFao0QMA0ZHHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQ6YD/5/Z7h2HP9Z81MG/4R7lL7UzjXPJOk4NnjV+7WVffOG3JXfs2eMHR11NvP3E Bi6NfNsLNV8NbXkw5N6ikHE/XF8WV93Nmd2WUweQWaiIe6YkZ3xJPb2mjv8V8PmbWu MY5udkiLQTBaqQK6kh6xdqRYba/L2ZzRDYqZkoiQ= 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.19 017/229] rpmsg: qcom: glink: replace strncpy() with strscpy_pad() Date: Mon, 24 Oct 2022 13:28:56 +0200 Message-Id: <20221024112959.697830355@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747571572433438547?= X-GMAIL-MSGID: =?utf-8?q?1747571572433438547?= 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 @@ -1472,7 +1472,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 @@ -1073,7 +1073,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; @@ -1304,7 +1304,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);