diff --git a/kernel/extended/hilog/los_hilog.c b/kernel/extended/hilog/los_hilog.c index 8ad4eb27784ef16bea036b72b4a05b43fa716783..532c254769a12ba5483a59423c1978b883e46fb8 100644 --- a/kernel/extended/hilog/los_hilog.c +++ b/kernel/extended/hilog/los_hilog.c @@ -321,8 +321,9 @@ out: static ssize_t HiLogWrite(struct file *filep, const char *buffer, size_t bufLen) { (void)filep; - if (bufLen + sizeof(struct HiLogEntry) > HILOG_BUFFER) { - PRINTK("input too large\n"); + size_t totalBufLen = bufLen + sizeof(struct HiLogEntry); + if ((totalBufLen < bufLen) || (totalBufLen > HILOG_BUFFER)) { + PRINTK("input bufLen %lld too large\n", bufLen); return -ENOMEM; }