From patchwork Mon May 20 11:27:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13668208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53B08C04FFE for ; Mon, 20 May 2024 11:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=O2SNw/hn5xOK9idnYboP3WigFSU7msulhFfjmjDgobU=; b=OoB8gHWZGPA2F3 cKNdOZflCHK/olmGVRxmj79Q8h9tSdTrMkB/jyqMibSBURoABzY25Ekj2YwqzRKElJwNloWlIiFm8 XybI8yQjKwuIHn5nT1BrQz4GxHAM6sufwoX7sXq3E5UVP+1dxkWTk8Xlddyw8UUYolQpgGIVoR5RI fcuEiUQb9mR3+nW9/Ql7b1gXA2+fu0Xk+M5CeSKn+KkTXTnCikFsYmwAB/2SA8jhyjKXt9oftJe94 iZh021FhaALMkllQKpEHZz8MQuiXXcGyb8jhj1xfwffnDgwLF917n5bk9ltvt3ezZBVWnj1i9JnSH x2Oe0Bcdcki2OEkT6p7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s91Az-0000000EHEb-0HD4; Mon, 20 May 2024 11:27:33 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s91Av-0000000EHE1-3o4M; Mon, 20 May 2024 11:27:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1716204447; bh=TugNqe9PlBp1NJ5MSXmFZQM1MVvwZOYkkhks49lJzMo=; h=From:To:Cc:Subject:Date:From; b=nr8DTS66gLZaW4X+w+Uv/tuKcFUStU+GvdhLQPuJsWF6N2J/AeLKzJlaCrbdHeHPV wF5qZXK6qH+0otnO0KZePovIQZ5wUUgttPqRj2H6m8VwcZ1YM8LS4q9WOzzEynsqP2 UGGc5ix3SAGst/HSwDWh42aF/JikrXPbYVYLP4h08H4mZC56+mjjvjg2kIOvRI2d86 MgcnZoUoZqoaQZOTFxaGXyP8IGMFjEl/KMqob1R81lGCyqGv6cDieiANg5HB1rL4ti /jFfJJ8P5zLGngFoaKGvNEVS/TjoPC0OpL5vzOzwnezaKC7cr81KjZevPwqUQXUDb5 F/raaUKoD42vg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id D88DD3780BFE; Mon, 20 May 2024 11:27:26 +0000 (UTC) From: AngeloGioacchino Del Regno To: mathieu.poirier@linaro.org Cc: andersson@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com Subject: [PATCH] remoteproc: mediatek: Zero out only remaining bytes of IPI buffer Date: Mon, 20 May 2024 13:27:24 +0200 Message-ID: <20240520112724.139945-1-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240520_042730_259478_46F25793 X-CRM114-Status: UNSURE ( 9.27 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In scp_ipi_handler(), instead of zeroing out the entire shared buffer, which may be as large as 600 bytes, overwrite it with the received data, then zero out only the remaining bytes. Signed-off-by: AngeloGioacchino Del Regno Acked-by: Mukesh Ojha --- drivers/remoteproc/mtk_scp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index e5214d43181e..dc70cf7db44d 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -117,8 +117,8 @@ static void scp_ipi_handler(struct mtk_scp *scp) return; } - memset(scp->share_buf, 0, scp_sizes->ipi_share_buffer_size); memcpy_fromio(scp->share_buf, &rcv_obj->share_buf, len); + memset(&scp->share_buf[len], 0, scp_sizes->ipi_share_buffer_size - len); handler(scp->share_buf, len, ipi_desc[id].priv); scp_ipi_unlock(scp, id);