lib/hash_algs.c: start search from alg_num=1

Since 0 means "invalid algorithm", when iterating through
fsverity_hash_algs[] it makes sense to start at 1 rather than 0.

Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
Eric Biggers
2020-06-05 16:51:47 -07:00
parent 40ba6849d7
commit 28d513fd53
+1 -1
View File
@@ -166,7 +166,7 @@ libfsverity_find_hash_alg_by_name(const char *name)
if (!name)
return 0;
for (i = 0; i < ARRAY_SIZE(fsverity_hash_algs); i++) {
for (i = 1; i < ARRAY_SIZE(fsverity_hash_algs); i++) {
if (fsverity_hash_algs[i].name &&
!strcmp(name, fsverity_hash_algs[i].name))
return i;