From patchwork Sun Aug 8 12:50:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Baker X-Patchwork-Id: 12424891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EC65C432BE for ; Sun, 8 Aug 2021 13:50:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2959A6101C for ; Sun, 8 Aug 2021 13:50:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbhHHNvA (ORCPT ); Sun, 8 Aug 2021 09:51:00 -0400 Received: from mout.gmx.net ([212.227.15.18]:54249 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbhHHNu7 (ORCPT ); Sun, 8 Aug 2021 09:50:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1628430627; bh=Ktznl9CYvf9P3FGZ74Aoo+T36/BoOc7RBNfte+REZSo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=R2zko4oE7hSiINxxBxFzyLb+HeAqm/NLJydnAPe00vh7CzpnF4YqZhhbEBhEfwl1j 0yuInVZpmmJazA95y4+osOLeUc5g0dAgeF4d8jQ2J0IynyOhWCOxiON84D9AuwZAdh eElg3Zlv6hdAH/rKINp2IZdBrtV6ZqEtgK/77rsE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([79.150.72.99]) by mail.gmx.net (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MiaY9-1moHo52zRf-00fiW9; Sun, 08 Aug 2021 15:50:26 +0200 From: Len Baker To: Andy Gross , Bjorn Andersson , Geert Uytterhoeven , Magnus Damm , Santosh Shilimkar Cc: Len Baker , Kees Cook , David Laight , Robin Murphy , linux-hardening@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 1/3] drivers/soc/qcom: Prefer strscpy over strcpy Date: Sun, 8 Aug 2021 14:50:10 +0200 Message-Id: <20210808125012.4715-2-len.baker@gmx.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210808125012.4715-1-len.baker@gmx.com> References: <20210808125012.4715-1-len.baker@gmx.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:bKMKh4yUQahWuZCqr9eYkhBfX4qp+zip5+o5puFZDzukWBlvHsz cFlJ7S/doOPwSj0tmIHU8PiOoVf/dMxmaZZwkZzK+3CoOFCR/Fq0d8OACmZ1z+kfh1pbNHR fo7Cmr7vOF4JkT7VadJ+xLcnni2w6bPY/jGbw9m9UGu0DbbW/uH+WD0OJn5xnW1f9z7sApP phIE7IwrGdHZ417jSOHJQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:SZaMBMHMq9U=:X4/f8pnYnJFLjNOfKICyc9 mN9/w9eAApH3pfHskmcO55ch3pe7vhMM4yM8GtxA3rB65FUKM0uyN2H+dbcwnRUyIq5JXX5a0 dM3Wqy9wg+1o8NzMylWJF5+/fESEUdAZwcpFSTlEr72aqr/mJHT9wUcX23wDmfyYocosuKWOk qsFUXYorMzk0fg5Nt52iJZfKr0/acRKc8OQ8Q3rLaOPyscG4F/szyduaAsu/r8VZXxYXxzwPn uYomkjJJrTmpYozdKeZkmZWXLsSCIz8asvMpp6CpXZsJSTKYOBj2LEu7LjbKwAW3/qhpdAbUT HDg0SJ2Z0ha/tIAlqjURCZvfTVn2SjDEKJhspxt1HVCs5fnyxP0sgSJBwEAhz3noXDXbDjzHs SgKin3LADIYxlBzO3hCJWHJZXWrzR96f0SX0BZEVwWrFf4tSq8DNjXT69wQhPX9GfuTm6Gjm2 x2DyKDxNqAOsbbqE5ZOhjXfp1VVZo0Y7OYulB213y7PedDTuQsV8l0AjaAOjFzxs7jWriWbDD 33A/a7TMLuT3hejk/+6adPB/E17J1+6EQvnu73cCRCVBU6GF3TwesFO0tkoppF1gn6qCLWaTC G3o08F4sKoRUfkH4k8eH0QIytfCsclzJGYb5JD5w00dQlXfYTB/Dqsae8Z+u10wA08GVcYtoC EQ2vkQsCW5a10gPkBM3qXHq/CpFm032QEqe9mtyvq6oVZUQNODYBL80AvBA8itmnNOF01UkBd UfPnI9xCg9dbbx1Nt2Qlu3vpwRkAHVNz1Ud0drZeAj7fYXuZ+nCNWdbL4SEmwANAha3YzIRjS XNl5qeJoik1Mzxem3PWKPcEHR75lWtgciRsDO7FpiQnD3GeNZ+TfUdYmP8enOD+2Wjxo/uurx AUK6IuMJ6R7pj83YolXI0OIE+v3qWTr/BIFxWtU7N7topeWfoviMCU0ANGms2vIgal3KwY7nU g4nyb/cCbIIRfEnYzgYK3xw2UF8+8PKf47b57VcjY/1EdqEfFMMaULilswhuR6zKnc9VPJfWj Z0df82eECByJdelrXpMdatoaSs0oBbWFNy3O7yT5kMWA1CCsDXIuh5rp/Z1XOGWXzIPwzcHU4 5dQE14EF1zSyA+PSQ83e9wrSZHhZYdHpSav9VGKPnLG/wSamz4esasimA== Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. The safe replacement is strscpy(). This is a previous step in the path to remove the strcpy() function entirely from the kernel. Signed-off-by: Len Baker --- drivers/soc/qcom/pdr_interface.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c index 915d5bc3d46e..fc580a3c4336 100644 --- a/drivers/soc/qcom/pdr_interface.c +++ b/drivers/soc/qcom/pdr_interface.c @@ -131,7 +131,7 @@ static int pdr_register_listener(struct pdr_handle *pdr, return ret; req.enable = enable; - strcpy(req.service_path, pds->service_path); + strscpy(req.service_path, pds->service_path, sizeof(req.service_path)); ret = qmi_send_request(&pdr->notifier_hdl, &pds->addr, &txn, SERVREG_REGISTER_LISTENER_REQ, @@ -257,7 +257,7 @@ static int pdr_send_indack_msg(struct pdr_handle *pdr, struct pdr_service *pds, return ret; req.transaction_id = tid; - strcpy(req.service_path, pds->service_path); + strscpy(req.service_path, pds->service_path, sizeof(req.service_path)); ret = qmi_send_request(&pdr->notifier_hdl, &pds->addr, &txn, SERVREG_SET_ACK_REQ, @@ -406,7 +406,7 @@ static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds) return -ENOMEM; /* Prepare req message */ - strcpy(req.service_name, pds->service_name); + strscpy(req.service_name, pds->service_name, sizeof(req.service_name)); req.domain_offset_valid = true; req.domain_offset = 0; @@ -531,8 +531,8 @@ struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr, return ERR_PTR(-ENOMEM); pds->service = SERVREG_NOTIFIER_SERVICE; - strcpy(pds->service_name, service_name); - strcpy(pds->service_path, service_path); + strscpy(pds->service_name, service_name, sizeof(pds->service_name)); + strscpy(pds->service_path, service_path, sizeof(pds->service_path)); pds->need_locator_lookup = true; mutex_lock(&pdr->list_lock); @@ -587,7 +587,7 @@ int pdr_restart_pd(struct pdr_handle *pdr, struct pdr_service *pds) break; /* Prepare req message */ - strcpy(req.service_path, pds->service_path); + strscpy(req.service_path, pds->service_path, sizeof(req.service_path)); addr = pds->addr; break; } From patchwork Sun Aug 8 12:50:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Baker X-Patchwork-Id: 12424917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8112C432BE for ; Sun, 8 Aug 2021 14:50:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B251C60F11 for ; Sun, 8 Aug 2021 14:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231887AbhHHOvF (ORCPT ); Sun, 8 Aug 2021 10:51:05 -0400 Received: from mout.gmx.net ([212.227.15.19]:54195 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231811AbhHHOvF (ORCPT ); Sun, 8 Aug 2021 10:51:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1628434230; bh=dnbnIgetA2HSvGj9st+ftD9THu1GINdsSq+4RvpezMU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ITqjeZmP19uQ5eS39HcPhVQJ04VERDZRvPlYhaOqe25rcXPcgneIiOwehe7RmgBnJ Ezssq4+CzoidNm/SWThQHqx2f5s0bmLLEUYK6CQw5x7lVyXhGzud6KbNggZ9uHXtwt K9oc2LIecG5P9lFH7uVeeBFoG7bWN80UW4DCFl98= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([79.150.72.99]) by mail.gmx.net (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MpUUw-1mvfmk07dk-00pqqk; Sun, 08 Aug 2021 16:50:30 +0200 From: Len Baker To: Andy Gross , Bjorn Andersson , Geert Uytterhoeven , Magnus Damm , Santosh Shilimkar Cc: Len Baker , Kees Cook , David Laight , Robin Murphy , linux-hardening@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 2/3] drivers/soc/renesas: Prefer memcpy over strcpy Date: Sun, 8 Aug 2021 14:50:11 +0200 Message-Id: <20210808125012.4715-3-len.baker@gmx.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210808125012.4715-1-len.baker@gmx.com> References: <20210808125012.4715-1-len.baker@gmx.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:s+2GOJ9JJjsrQL+ZL7tVIYQT5stQLcH+ApXr/G0xsuDveEeU+Lc UFhX/NHZhKRTsI6HwSAQBN1JTxA00ohLhPKfajdptUJloOjUvvQVBAAXizU6zT6gn+YgC2r 2vvhiyObK++tgAVoOdyDb7Zj4wPVz7pjQ18l7kJ47hob54tVPJU7QP5764z1tNq/Jl4eaFi 9plXTxWkG1P78F3/uDkkA== X-UI-Out-Filterresults: notjunk:1;V03:K0:CBcb5hSVrJs=:xegYaanLnDtAf8ejrmzmke u27N1yH+y5rqraLuZv4PCarTIYwdRkwQCTYMrTwNiA46i65D+bz/qryrLyZGXo08pQzZI92xk QHwV/nsFDSJXfZh22hutInt4QkZCI1cKqMuSONn5NZ9g6EfIW5JP8RnITlqYw/FP3Y+awHYIH x7xJND8PUSyLfAQHr7KOnvBXE6yOc+FRP8zlv4Ofi4Sw33JaTZ9/wbhpw5y175a9z3WaPnJtD /va1ER2ZONP6bqpCrm3puSHBmJmMfYKyKzAwVOcqbND2GCxV/samcLS5WlNWsYROEXwX/uiBW Mu06YGsX9p8CgkhYQNOwmKQRFKlKdYbuQUfFdzGccuI8m91YTIucXoEL3mPr9NpjgSYQGNLtS 5Ci7qFy16bkD3rUqSLHfgrqXWmW173MYOePC9U9CHO07bHvBrHnpQy/p+VFWMdZSzCxSxD6Rd +TOVg0xLfCKp7fJLG8Gz61PTh+iXs8+joFiyVTtUMEH6sv2S0cpIV+AgRPIB6l2rsTatfu5YE zAMprlVhgzsZVDHW5cMI9FEippsW+MEMQOilAdybuYFD3PY1nCi2vkSclTduq8s5r4xLVGHKh coGkvYR+l9dLzxwpYUw088g/E+8+/ahpTqqcDvTdtwDCRnpO60TYZaAaXQbvPVd5KiGvG1zf4 rGRzPquFIhTIObDPAMkmrCYPplbML9l9iCA7uHHnr0ZCJFqq/26pWu6ijICM8sDdIlQp7/Acc 4IuavGaljyKlm9xCDmri6RVBnPOAwSU7++w+vjrDbTUJlP3XLzUROJreZfYe9M4JqyFxlyWy5 Dhw6Sn/MLtrZeuO4YTV83uVuUMGAb20I9Upe8oI5DC1mR8N/yUv/IVaoh/rajjpjtL7b+N7z/ ipgrse3gJjVR7LfcFPxmmsig4vzDbB+Plz5Ea6PM5EuyHbYQPsoNkhUlT0jDnbWbGKZV4s0K8 xTvY8QtfGhz70CB2olSzlrskA6pvZ9c85VnAfFhimC5SuXtHN6zb5VWF416rf53svJvVq3/W+ tgSYPFzRdXYAM2i0HRV6LrNJPZwgDXkQ8ubfAiHEZWJOsB9h9V54a6fnrnUIRasrxSO/dR0Wx 0TAUkC6EW5XdCwU4XW9eoalUmIsdDdBQhaoHwQvokN6F6/yyv+157B2PA== Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. So, use memcpy() as a safe replacement. This is a previous step in the path to remove the strcpy() function entirely from the kernel. Signed-off-by: Len Baker Reviewed-by: Geert Uytterhoeven --- drivers/soc/renesas/r8a779a0-sysc.c | 6 ++++-- drivers/soc/renesas/rcar-sysc.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/drivers/soc/renesas/r8a779a0-sysc.c b/drivers/soc/renesas/r8a779a0-sysc.c index d464ffa1be33..7410b9fa9846 100644 --- a/drivers/soc/renesas/r8a779a0-sysc.c +++ b/drivers/soc/renesas/r8a779a0-sysc.c @@ -404,19 +404,21 @@ static int __init r8a779a0_sysc_pd_init(void) for (i = 0; i < info->num_areas; i++) { const struct r8a779a0_sysc_area *area = &info->areas[i]; struct r8a779a0_sysc_pd *pd; + size_t n; if (!area->name) { /* Skip NULLified area */ continue; } - pd = kzalloc(sizeof(*pd) + strlen(area->name) + 1, GFP_KERNEL); + n = strlen(area->name) + 1; + pd = kzalloc(sizeof(*pd) + n, GFP_KERNEL); if (!pd) { error = -ENOMEM; goto out_put; } - strcpy(pd->name, area->name); + memcpy(pd->name, area->name, n); pd->genpd.name = pd->name; pd->pdr = area->pdr; pd->flags = area->flags; diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c index 53387a72ca00..b0a80de34c98 100644 --- a/drivers/soc/renesas/rcar-sysc.c +++ b/drivers/soc/renesas/rcar-sysc.c @@ -396,19 +396,21 @@ static int __init rcar_sysc_pd_init(void) for (i = 0; i < info->num_areas; i++) { const struct rcar_sysc_area *area = &info->areas[i]; struct rcar_sysc_pd *pd; + size_t n; if (!area->name) { /* Skip NULLified area */ continue; } - pd = kzalloc(sizeof(*pd) + strlen(area->name) + 1, GFP_KERNEL); + n = strlen(area->name) + 1; + pd = kzalloc(sizeof(*pd) + n, GFP_KERNEL); if (!pd) { error = -ENOMEM; goto out_put; } - strcpy(pd->name, area->name); + memcpy(pd->name, area->name, n); pd->genpd.name = pd->name; pd->ch.chan_offs = area->chan_offs; pd->ch.chan_bit = area->chan_bit; From patchwork Sun Aug 8 12:50:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Baker X-Patchwork-Id: 12424923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DATE_IN_PAST_03_06, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E503C432BE for ; Sun, 8 Aug 2021 15:50:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B7AE60FF2 for ; Sun, 8 Aug 2021 15:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232149AbhHHPvG (ORCPT ); Sun, 8 Aug 2021 11:51:06 -0400 Received: from mout.gmx.net ([212.227.15.18]:33365 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbhHHPvF (ORCPT ); Sun, 8 Aug 2021 11:51:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1628437832; bh=8WpITWSAmjBFl5ukEIIIh0d8OHw71Lp48DGXmRGeV/w=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=BYo69O9ZP31BaGHrttIW3DNXq5fsutLC41vClAk6H35xvuJnDEaTeQkt882+sli2S 2zRg9IM9rLshVQr76zjdU/siM1XIhrV5DGCa8+OSeFvcFWuXPM4fnl62KG2W/zcnMS p5HBmLVDPLTX/xCePS6ePL3UqU+5U7dVMFUOgxHA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([79.150.72.99]) by mail.gmx.net (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MmDEg-1muaHQ0Bxg-00i9Ax; Sun, 08 Aug 2021 17:50:32 +0200 From: Len Baker To: Andy Gross , Bjorn Andersson , Geert Uytterhoeven , Magnus Damm , Santosh Shilimkar Cc: Len Baker , Kees Cook , David Laight , Robin Murphy , linux-hardening@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 3/3] drivers/soc/ti: Prefer strscpy over strcpy Date: Sun, 8 Aug 2021 14:50:12 +0200 Message-Id: <20210808125012.4715-4-len.baker@gmx.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210808125012.4715-1-len.baker@gmx.com> References: <20210808125012.4715-1-len.baker@gmx.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:NAahUXrhbe23vphH2V5V8QzAnruX6eosbWznab34o/LlPE7OlPz ZAfqE/aSfFY2bE99SUHctzIhbGTUQWHJNn/Zi33p7hM9YmI1PaIFMOPJRHQnTYzgKnn6JtG TNmZoPeYiGN/nvP6EicoyWFdt6UhpXby+7FGeJAnE5Qm5siNwa/rOu+5cWNMuUolLKmgMet 1iEvwDwn9LM+wXyxXKeaQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:u4E+rKRzLoQ=:p3dXkD+lKAXeP09tYd/b7D qn8vWRi74uC9vfxuScHam1WxhNd120vw1V40MrsM6nyCiFv9Uc33D374I0bN9CGAkfJkWKwt7 bxG5BcKad746HcV7lgz4WImjOEkbmILVwkvt4YULxO4eFLQzE9VJShbifmodkfN7V3n1jrv3d HU3ltcoOaxStaDVSwcJ7MIvwWqJCP08wks3Fp3IvPhfS9GusREs5YrE5MncFt/uSRNYRiCqxX JCRzxhHVi9bx2epIa1RVZa4IYTHsw6QYn2P14bTi/dg6tHhjRK0+Ax005k5Rc6MxLl+uGVmPy 7OlftBhjc14/CGGsFPtoiR86p+uFLP1CEMD4S81UPMER4UgAc3t03wTsocmJbpYh09V3gc9f6 XmOoL8Aq3OV1WAymxGY0o9VvH/6F0H/HscnBM+hHScAJ4isMJondiGehJdIMCqqa6uS45oU7F 33EKZ25HmfSH+E5kXT7XZj6OqkcV3F62BfkTGcghqZiCCpuPtdUc57weM/04Zt3xC0Z6ogIPW DVv+un8BttTZSBfcyq4GkAPt0IO0l8MMZRot12IAGClnAfTJTOJWsTF42E+prGhZBGYgEbbkA 3K0z38AWuCSgyRWJXflj/4FNEYYk6QKrH6d2U+sSzM8VkgDzqGzElZqRU8KAJC8FaqMi0ccJr eyMRqePpr5jj4CbGuqldgl+gM0gPtuQ9MQJy2mRgvvtHfSBbbSVbnh59qybmlJ+3SQmo0ml5z mWsBRORfOFu1SR/980MlKJ9dY0s29bqcr8Lr1hIQ3WSz2AEeF9Ma1o0OBLIKd9TVPIzUTx79H bDrKeE4WYdVnkvtb5pyiuC7Gn47QwV4acL73BLQJvl25Mi/9bPDnRohcPpHq5BeT7wZX0dgTf fMJsQAcAL4nlEyopqtVJrQNdftSBfiipOkyFQupCTw4qGk2J8AAL2QAedYYWZ9yOT7fNbx+ue fo3jGU1RkiuHRzPS1OB50OgfUbpl9wQRrdJ3wdJUzTHDg0hZUjasOvDMUReP3VZCEoq5dCKNp BaNRaQ8RoJn31P9fd8crvjBwK4IgonyBGcajCsc0F3i6LrsFwKxu99hvCVAUS6I9eGWbKcVyz 7XMSfwykaJABkmtEi2C+bgh4crafcW7oUDA6pvxmPkZEdBEO0pDSpLkrQ== Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. The safe replacement is strscpy(). This is a previous step in the path to remove the strcpy() function entirely from the kernel. Signed-off-by: Len Baker --- drivers/soc/ti/knav_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c index 591d14ebcb11..5f9816d317a5 100644 --- a/drivers/soc/ti/knav_dma.c +++ b/drivers/soc/ti/knav_dma.c @@ -691,7 +691,7 @@ static int dma_init(struct device_node *cloud, struct device_node *dma_node) dma->max_rx_flow = max_rx_flow; dma->max_tx_chan = min(max_tx_chan, max_tx_sched); atomic_set(&dma->ref_count, 0); - strcpy(dma->name, node->name); + strscpy(dma->name, node->name, sizeof(dma->name)); spin_lock_init(&dma->lock); for (i = 0; i < dma->max_tx_chan; i++) {