const char *nvme_auth_dhgroup_name(u8 dhgroup_id)
{
- if (dhgroup_id > ARRAY_SIZE(dhgroup_map))
+ if (dhgroup_id >= ARRAY_SIZE(dhgroup_map))
return NULL;
return dhgroup_map[dhgroup_id].name;
}
const char *nvme_auth_dhgroup_kpp(u8 dhgroup_id)
{
- if (dhgroup_id > ARRAY_SIZE(dhgroup_map))
+ if (dhgroup_id >= ARRAY_SIZE(dhgroup_map))
return NULL;
return dhgroup_map[dhgroup_id].kpp;
}
const char *nvme_auth_hmac_name(u8 hmac_id)
{
- if (hmac_id > ARRAY_SIZE(hash_map))
+ if (hmac_id >= ARRAY_SIZE(hash_map))
return NULL;
return hash_map[hmac_id].hmac;
}
const char *nvme_auth_digest_name(u8 hmac_id)
{
- if (hmac_id > ARRAY_SIZE(hash_map))
+ if (hmac_id >= ARRAY_SIZE(hash_map))
return NULL;
return hash_map[hmac_id].digest;
}
size_t nvme_auth_hmac_hash_len(u8 hmac_id)
{
- if (hmac_id > ARRAY_SIZE(hash_map))
+ if (hmac_id >= ARRAY_SIZE(hash_map))
return 0;
return hash_map[hmac_id].len;
}