liblog: remove faulty logic in __android_logger_valid_buffer_size
In testing, I saw that the 'main' and 'events' log buffers were set to incorrect sizes when they were intended to be >= 4MB. The bug is tracked down to an invalid line in __android_logger_valid_buffer_size(): /* maximum memory impact a somewhat arbitrary ~3% */ pages = (pages + 31) / 32; There are two issues with this line: 1) That is not the right calculation for 3%. 2) `pages` is a static variable, so it repeatedly is decremented until reaching 1. The consequence is that this function gives invalid results for the first few calls, then returns true as long as the input is between LOG_BUFFER_MIN_SIZE and LOG_BUFFER_MAX_SIZE. That check is enough, so the rest of this logic is removed. Test: buffers are set to the right sizes. Change-Id: I4d19b1d0fdbd83843d2d61a484ac083d571ef37b
Loading
Please register or sign in to comment