Commit 678db6cc432dd7b048d78261ff0286523530630c

Authored by Arkadiusz Materek
1 parent 9f80c454

DALI XMC1200 impl memory fix.

Showing 1 changed file with 4 additions and 4 deletions
src/xmc1200/dali/memory.cpp
... ... @@ -346,14 +346,14 @@ size_t Memory::dataSize() {
346 346 }
347 347  
348 348 size_t Memory::dataWrite(uintptr_t addr, const uint8_t* data, size_t size) {
349   - if (addr + size > FLASH_MEMORY_SIZE) {
  349 + if (addr > FLASH_MEMORY_SIZE || addr + size > FLASH_MEMORY_SIZE) {
350 350 return 0;
351 351 }
352 352 return ((FlashMemory*) mHandle)->write(addr, data, size);
353 353 }
354 354  
355 355 const uint8_t* Memory::data(uintptr_t addr, size_t size) {
356   - if (addr + size > FLASH_MEMORY_SIZE) {
  356 + if (addr > FLASH_MEMORY_SIZE || addr + size > FLASH_MEMORY_SIZE) {
357 357 return nullptr;
358 358 }
359 359 return ((FlashMemory*) mHandle)->getData(addr);
... ... @@ -364,14 +364,14 @@ size_t Memory::tempSize() {
364 364 }
365 365  
366 366 size_t Memory::tempWrite(uintptr_t addr, const uint8_t* data, size_t size) {
367   - if (addr + size > TEMP_SIZE) {
  367 + if (addr > TEMP_SIZE || addr + size > TEMP_SIZE) {
368 368 return 0;
369 369 }
370 370 return ((FlashMemory*) mHandle)->write(mTempAddr + addr, data, size);
371 371 }
372 372  
373 373 const uint8_t* Memory::tempData(uintptr_t addr, size_t size) {
374   - if (addr + size > TEMP_SIZE) {
  374 + if (addr > TEMP_SIZE || addr + size > TEMP_SIZE) {
375 375 return nullptr;
376 376 }
377 377 return ((FlashMemory*) mHandle)->getData(mTempAddr + addr);
... ...