Description:[fix] clean hilog/hievent ring buffer after memory verification failed

Change-Id: I9310fe807ec95721be78deb60ed9728ef9b56e48
Signed-off-by: shenchenkai <shenchenkai@huawei.com>
This commit is contained in:
shenchenkai 2021-10-22 16:59:53 +08:00
parent e328c528b1
commit c121d0eea3
1 changed files with 7 additions and 0 deletions

View File

@ -201,6 +201,13 @@ static ssize_t HiLogRead(struct file *filep, char *buffer, size_t bufLen)
HiLogBufferDec(header.len);
retval = header.len + sizeof(header);
out:
if (retval == -ENOMEM) {
// clean ring buffer
g_hiLogDev.writeOffset = 0;
g_hiLogDev.headOffset = 0;
g_hiLogDev.size = 0;
g_hiLogDev.count = 0;
}
(VOID)LOS_MuxRelease(&g_hiLogDev.mtx);
return retval;
}