summaryrefslogtreecommitdiff
path: root/wifi/1.2/default/ringbuffer.cpp
diff options
context:
space:
mode:
authorxshu <xshu@google.com>2018-01-24 15:40:06 -0800
committerxshu <xshu@google.com>2018-01-24 17:43:48 -0800
commit4cb3316da4b2a92a7dfc9c555fc184ea0d29ca41 (patch)
tree33770d92ef5e41b8d652ce7be2e02f6cb9b5d998 /wifi/1.2/default/ringbuffer.cpp
parent6919c7be72c975d7a6353bb990b9fafc4880bf74 (diff)
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
Diffstat (limited to 'wifi/1.2/default/ringbuffer.cpp')
-rw-r--r--wifi/1.2/default/ringbuffer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/wifi/1.2/default/ringbuffer.cpp b/wifi/1.2/default/ringbuffer.cpp
index 5511f2ffba..c126b36912 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 @@ void Ringbuffer::append(const std::vector<uint8_t>& input) {
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_) {