Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 0315b294 authored by Tom Cherry's avatar Tom Cherry
Browse files

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
parent 69b513ce
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment