NVM: fixed bound check error in nvm_getDesc()
This commit is contained in:
parent
4515bd9e60
commit
40e2e5c38e
|
|
@ -134,7 +134,7 @@ void nvm_terminate()
|
||||||
|
|
||||||
const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
||||||
{
|
{
|
||||||
if(index > 2)
|
if(index >= ARRAY_SIZE(nvmDevices))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return &nvmDevices[index];
|
return &nvmDevices[index];
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ void nvm_terminate()
|
||||||
|
|
||||||
const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
||||||
{
|
{
|
||||||
if(index > 3)
|
if(index >= ARRAY_SIZE(nvmDevices))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return &nvmDevices[index];
|
return &nvmDevices[index];
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ void nvm_terminate()
|
||||||
|
|
||||||
const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
||||||
{
|
{
|
||||||
if(index > 0)
|
if(index >= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return &stateNvm;
|
return &stateNvm;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ void nvm_terminate()
|
||||||
|
|
||||||
const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
||||||
{
|
{
|
||||||
if(index > 0)
|
if(index >= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return &nvMemory;
|
return &nvMemory;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue