]> www.infradead.org Git - linux.git/commitdiff
remoteproc: mediatek: Zero out only remaining bytes of IPI buffer
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Mon, 20 May 2024 11:27:24 +0000 (13:27 +0200)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Tue, 28 May 2024 18:49:46 +0000 (12:49 -0600)
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 <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240520112724.139945-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
drivers/remoteproc/mtk_scp.c

index b8498772dba170dba0cf47cc962e99e13143b7ea..b885a9a041e48e02ef99edc58e4ea56e4b80a28d 100644 (file)
@@ -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);