NVM: fixed bound check error in nvm_getDesc()

This commit is contained in:
marco 2025-02-08 19:02:36 +01:00 committed by Silvano Seva
parent 4515bd9e60
commit 40e2e5c38e
4 changed files with 4 additions and 4 deletions

View File

@ -134,7 +134,7 @@ void nvm_terminate()
const struct nvmDescriptor *nvm_getDesc(const size_t index)
{
if(index > 2)
if(index >= ARRAY_SIZE(nvmDevices))
return NULL;
return &nvmDevices[index];

View File

@ -89,7 +89,7 @@ void nvm_terminate()
const struct nvmDescriptor *nvm_getDesc(const size_t index)
{
if(index > 3)
if(index >= ARRAY_SIZE(nvmDevices))
return NULL;
return &nvmDevices[index];

View File

@ -152,7 +152,7 @@ void nvm_terminate()
const struct nvmDescriptor *nvm_getDesc(const size_t index)
{
if(index > 0)
if(index >= 0)
return NULL;
return &stateNvm;

View File

@ -46,7 +46,7 @@ void nvm_terminate()
const struct nvmDescriptor *nvm_getDesc(const size_t index)
{
if(index > 0)
if(index >= 0)
return NULL;
return &nvMemory;