camerad: zero memory before returning from MemoryManager::alloc (#30781)
* zero memory * remove redundant memset --------- Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: b9080d23627849aafc4969d39df50cc615ffecdf
This commit is contained in:
@@ -135,7 +135,6 @@ int CameraState::sensors_init() {
|
||||
buf_desc[1].size = buf_desc[1].length = 196;
|
||||
buf_desc[1].type = CAM_CMD_BUF_I2C;
|
||||
auto power_settings = mm.alloc<struct cam_cmd_power>(buf_desc[1].size, (uint32_t*)&buf_desc[1].mem_handle);
|
||||
memset(power_settings.get(), 0, buf_desc[1].size);
|
||||
|
||||
// power on
|
||||
struct cam_cmd_power *power = power_settings.get();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "system/camerad/cameras/camera_util.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
@@ -111,6 +113,7 @@ void *MemoryManager::alloc_buf(int size, uint32_t *handle) {
|
||||
size_lookup[ptr] = size;
|
||||
}
|
||||
lock.unlock();
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user