From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ramon Fried Date: Fri, 25 May 2018 13:41:28 +0300 Subject: [U-Boot] [PATCH 6/6] common: iotrace: fix behaviour when buffer is full In-Reply-To: <20180525104128.7990-1-ramon.fried@gmail.com> References: <20180525104128.7990-1-ramon.fried@gmail.com> Message-ID: <20180525104128.7990-7-ramon.fried@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de When the buffer is full, there supposed to be no more writes, the code however misses the else statement and subsequently writes to arbitrary pointer location and increases the offset. This patch fixes that by returning immediately. Signed-off-by: Ramon Fried --- common/iotrace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/iotrace.c b/common/iotrace.c index 74408a5dbb..5f06d2b250 100644 --- a/common/iotrace.c +++ b/common/iotrace.c @@ -55,6 +55,8 @@ static void add_record(int flags, const void *ptr, ulong value) rec = (struct iotrace_record *)map_sysmem( iotrace.start + iotrace.offset, sizeof(value)); + } else { + return; } rec->timestamp = get_ticks(); -- 2.17.0