Followup CL for ringbuffer in wifi_hal
Bug: 72462185
Test: compile, unit tests
Test: manual
flash device
In a terminal create the archive:
adb shell
su
cd bugreports
lshal debug android.hardware.wifi@1.2::IWifi >> archive.cpio
In another termial pull and extract the archive:
adb pull bugreports/archive.cpio
cpio -iv < archive.cpio
Verify extracted files are the same as files generated in device under
/data/vendor/tombstones/wifi
Change-Id: Ia2e89dd08edce1f0ec6c0c6e2c26231a0a9d4cc4
diff --git a/wifi/1.2/default/ringbuffer.cpp b/wifi/1.2/default/ringbuffer.cpp
index 5511f2f..c126b36 100644
--- a/wifi/1.2/default/ringbuffer.cpp
+++ b/wifi/1.2/default/ringbuffer.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <android-base/logging.h>
+
#include "ringbuffer.h"
namespace android {
@@ -28,6 +30,11 @@
if (input.size() == 0) {
return;
}
+ if (input.size() > maxSize_) {
+ LOG(INFO) << "Oversized message of " << input.size()
+ << " bytes is dropped";
+ return;
+ }
data_.push_back(input);
size_ += input.size() * sizeof(input[0]);
while (size_ > maxSize_) {