Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp378044rwi; Mon, 10 Oct 2022 01:27:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Sfu04+wdZAFNYodzYz9Y+7fkRaBx6dkULDu9WbZXjIMkQaf+/idm6i+ajY6t0kWTGFprK X-Received: by 2002:a05:6402:410:b0:451:ea13:4ed7 with SMTP id q16-20020a056402041000b00451ea134ed7mr17453189edv.262.1665390457004; Mon, 10 Oct 2022 01:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665390456; cv=none; d=google.com; s=arc-20160816; b=IkF8raSG5h1L7WEbGmeZLvxeybLdG9EZBm4qTAtVFbUihfSTEYjmKRXHxvruF43qYs fpEio7RNrsrbiW2aszAs8mS+koKXtZIpBuiNWYpC3eXz6Giu+SkhHITASv0IJ80jN+sO hyviF0BkX0K1+Xzv/NkyW6zaW4judFkfRJh8iY5VoH6Fn7E3TaG+iaCY8aQL4YiC+ip7 zfhdbOYkiFy935gjybvvGZD/qBc0ZXbzQhg6K1u1MBdyjfgu0jIr+ORHAsvxbNz9csy2 UW6oA4O0GWnOT1FyV95FGeh/flWOdQbKEnPzNURMRVPZrRRuUjytqht/3t5y256Y1Z9N +EWQ== 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=6f3V8w2afyXhU0ZoNYvJbShCzq5iW1N8DRMmG+IWU5w=; b=Kk7aYiFQNIZauQe1b7wzFnKgh5fHd1a0kDS3XkKL1oWZieL0ZdiEg7uxZZiKmobvFZ l+J0L4NLFaDW7wPk2arFozPcBh29Ok+c7zZm6IEiNqRKfV6zqBGcdouZhsgK9iG8n7zA 6lKrPD8N9RmhtSrpjX0fTd49JkWsN4EoZlDiLXr7ofrQUnyyhswLLmu9d3msl8N01Vrp aIpqZqpp3uWOGvrk1mMsyoy8HM/3t/v8CLzwglsn8sMOon6cqFfGxKbD2xD1fwvv+4Ea 29otJt4VEhNc494pJCJRHQMzEMaitOAmDYT7y195zMHZAmNa8xKr23wQvi8Mk2A7uyye rrtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1bwtrokO; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a05640208d500b0045b68639617si5912857edz.608.2022.10.10.01.27.05; Mon, 10 Oct 2022 01:27:36 -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=1bwtrokO; 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 S232237AbiJJHQh (ORCPT + 99 others); Mon, 10 Oct 2022 03:16:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232145AbiJJHOh (ORCPT ); Mon, 10 Oct 2022 03:14:37 -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 E567914D27; Mon, 10 Oct 2022 00:10:02 -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 9E6A260E83; Mon, 10 Oct 2022 07:08:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B37E6C433D6; Mon, 10 Oct 2022 07:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385723; bh=bg+fXWhbiJblWZxr5Rut0rtM+wplAIfjOBz3ht/2cf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1bwtrokO/F8Oil+9IGP3ZQ47JwPLJ6enmBtpU8iBlXXX7iLTYDQu/lotwEBNljZvN xPFULVZfDHS2crVOif4h5gqjP1IIqhX4vf5TBZOiZclY3xu4wfqrQd8PNAA2xP6yHH DG15oDbP469q29kSnQIBsL1IJPIM57JEJdAjpOv8= 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 5.15 37/37] rpmsg: qcom: glink: replace strncpy() with strscpy_pad() Date: Mon, 10 Oct 2022 09:05:56 +0200 Message-Id: <20221010070332.252611854@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070331.211113813@linuxfoundation.org> References: <20221010070331.211113813@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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 @@ -1488,7 +1488,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 @@ -1089,7 +1089,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; @@ -1320,7 +1320,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);