From patchwork Tue Feb 14 14:08:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 57038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3007137wrn; Tue, 14 Feb 2023 06:31:32 -0800 (PST) X-Google-Smtp-Source: AK7set+0e56FLOw2ABEHnMmbqbZgAWPnvTtiiA/U+c0NZfwDHjSN+GwhQAIHPcOrCDG+AUVcC97u X-Received: by 2002:a62:644b:0:b0:5a8:bd95:6575 with SMTP id y72-20020a62644b000000b005a8bd956575mr2127131pfb.23.1676385092340; Tue, 14 Feb 2023 06:31:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385092; cv=none; d=google.com; s=arc-20160816; b=q+f9p2FR/usrZGO6xZGeJLwHfkEn46QWnAwXJfjyxoPnfU5HtCqAb0uYuOrsyI/5z5 5x/vokYwZ2DgXnZR9oysnqNhXpm9k4IRF9RdCjqe4eh6dInhwZlvr/c86lM1KWXbtBQO a6ex/tqzJhFwKiS3iOUWGUQKhfPhdY4WBh1BhNhOMiUx11hX2qDc/6WO+2BvQxOaS4LH 4JfP10yAVxK8UWQ71SBXNXVZ14bsym6MH3/xc23q5+kaDiITFz7HDApYD9WjYtN04pCF ZpypKxviksGWPTQvyk8prmThiYSkV2VkSglJxRefbDR08cOYqA5nvAz689YAhBZVJPo6 2tWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8mygu5FXiy1g7uRE+cixCgfveLY0wc4wOwNgZ8bqBWM=; b=ld0Mu29jSH5K7m2vKubDSR917nB3MYeNFQ8rBB77pqQq6shIHlsWBZU/8elS7t8W4Y osUHthrXRUCPgfh9A0LDWi26u4mqR2m9uJ9au+80B+HJXa1bHRTE1TzVl8nKz+NhpfXK 8ZAbLthjqVETB5iucSf64B4g0vIR3usjCHaCru28chrs0N/nskTBi5iE7PkWTM6IiXtl vV4An503LaKbb3HOlZoZJ1Y54cIHy+VyLblzAFE7pPx4H76c8nHeDnlZMw3gm+mKFn4s ctwIK0HqVXFVNSrdVeS965jSKtDM5606lV3FsjLwkdbE8NbPINw8IgtkgKVDyt9sX2yA tYSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=PqZ9PZHG; 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=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d83-20020a621d56000000b00592b99884b2si202011pfd.44.2023.02.14.06.31.15; Tue, 14 Feb 2023 06:31:32 -0800 (PST) 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=@quicinc.com header.s=qcppdkim1 header.b=PqZ9PZHG; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbjBNOXh (ORCPT + 99 others); Tue, 14 Feb 2023 09:23:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231784AbjBNOXa (ORCPT ); Tue, 14 Feb 2023 09:23:30 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FD4430D3; Tue, 14 Feb 2023 06:22:50 -0800 (PST) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31E4rDH9017289; Tue, 14 Feb 2023 14:08:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=8mygu5FXiy1g7uRE+cixCgfveLY0wc4wOwNgZ8bqBWM=; b=PqZ9PZHGKsBH+Ty2L1JlrcQNIeOGxidzrsdZWuAJtnu0qm9CzckL9O38Sm1QhwY3T1yb GJ/YryoRZ1RscKamhZiV6X7HcTY/F1Bj+JZS9Ha7sunzeZnTO4tLHfWCVFIHVV7nQaPe bo+UiGwFFKfFNsCMlYCF/L2DJqPVydrqgw3RwRqEeqMHp0B1Gpvx4jsosTNFfedJNgJp FCAv4uAz2QC5Lpw8sxvPQlDk/piEB7IziV0AukhLm178IMKclat4GaXiBq+7YLMvVzHJ FEivoAXL6s9jvTAmI2mIcIWbpg81q0LTkK8jOEhTlhnx/7ziwRo/RyYnWgZc1kTi1zvO XQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3nqyygsnu7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Feb 2023 14:08:24 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 31EE8Nll018775 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Feb 2023 14:08:23 GMT Received: from hu-mojha-hyd.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 14 Feb 2023 06:08:20 -0800 From: Mukesh Ojha To: , , , CC: , , , Mukesh Ojha Subject: [PATCH] remoteproc: qcom: replace kstrdup with kstrndup Date: Tue, 14 Feb 2023 19:38:11 +0530 Message-ID: <1676383691-29738-1-git-send-email-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1675180866-16695-1-git-send-email-quic_mojha@quicinc.com> References: <1675180866-16695-1-git-send-email-quic_mojha@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: sPUWClOX--ZR6Pl94Bq1N4QhwQs6NIpD X-Proofpoint-GUID: sPUWClOX--ZR6Pl94Bq1N4QhwQs6NIpD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-14_07,2023-02-14_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 impostorscore=0 malwarescore=0 adultscore=0 mlxlogscore=866 mlxscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302140120 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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?1757817174812292470?= X-GMAIL-MSGID: =?utf-8?q?1757817174812292470?= Since, there is no guarantee that region.name will be 0-terminated from the firmware side, replace kstrdup with kstrndup. Suggested-by: Dmitry Baryshkov Signed-off-by: Mukesh Ojha --- drivers/remoteproc/qcom_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index 020349f..7810f91 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -124,7 +124,7 @@ static int qcom_add_minidump_segments(struct rproc *rproc, struct minidump_subsy for (i = 0; i < seg_cnt; i++) { memcpy_fromio(®ion, ptr + i, sizeof(region)); if (region.valid == MD_REGION_VALID) { - name = kstrdup(region.name, GFP_KERNEL); + name = kstrndup(region.name, MAX_REGION_NAME_LENGTH - 1, GFP_KERNEL); if (!name) { iounmap(ptr); return -ENOMEM;