mirror of
https://github.com/ong19th/Citron.git
synced 2025-12-14 07:37:04 +00:00
common/nvdrv: improve memory validation and error handling
Implements several improvements to memory handling and validation: - host_memory: Add IsValidMapping() and IsDirectMappingEnabled() methods to validate memory access - host_memory: Fix virtual base offset calculation to use proper pointer arithmetic - host_memory: Add size field to track allocation size - nvhost_ctrl_gpu: Return InvalidState instead of InvalidValue for TPC mask buffer size validation - Update copyright year for citron The changes improve memory safety by adding explicit validation checks and fixing pointer arithmetic in the virtual memory implementation.
This commit is contained in:
parent
70a9f20ae1
commit
f4b9e54b22
3 changed files with 32 additions and 2 deletions
|
|
@ -270,7 +270,7 @@ NvResult nvhost_ctrl_gpu::GetTpcMasks2(IoctlGetTpcMasks& params) {
|
|||
// Validate input parameters
|
||||
if (params.mask_buf_size == 0 || params.mask_buf_size > params.tpc_mask_buf.size()) {
|
||||
LOG_ERROR(Service_NVDRV, "Invalid mask buffer size {}", params.mask_buf_size);
|
||||
return NvResult::InvalidValue;
|
||||
return NvResult::InvalidState;
|
||||
}
|
||||
|
||||
// Set up TPC mask values based on GPU configuration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue