From b69c645f30d97f22e5a4a0ac4b56fb284af18fc5 Mon Sep 17 00:00:00 2001 From: Sridharan S N Date: Mon, 20 Nov 2023 12:44:25 +0530 Subject: [PATCH] coresight: tmc-etr: fix the memory leak In function tmc_etr_alloc_rsvd_buf, flat_buf is dynamically allocated memory using kzalloc. But it is not freed leading to potential memory leak. Hence free the flat_buf. Change-Id: I88504c938e8056cfcece23e390f46570d6f056fe Signed-off-by: Sridharan S N --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 9c04544dfb34..79c33ebedbe1 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -722,6 +722,8 @@ static int tmc_etr_alloc_rsvd_buf(struct tmc_drvdata *drvdata, */ static void tmc_etr_free_rsvd_buf(struct etr_buf *etr_buf) { + struct etr_flat_buf *flat_buf = etr_buf->private; + kfree(flat_buf); } -- 2.34.1