提交 b4df8608 编写于 作者: Y Yisheng Xie 提交者: Mimi Zohar

ima: use match_string() helper

match_string() returns the index of an array for a matching string,
which can be used intead of open coded variant.
Signed-off-by: NYisheng Xie <xieyisheng1@huawei.com>
Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
上级 6f0911a6
......@@ -59,14 +59,11 @@ static int __init hash_setup(char *str)
goto out;
}
for (i = 0; i < HASH_ALGO__LAST; i++) {
if (strcmp(str, hash_algo_name[i]) == 0) {
ima_hash_algo = i;
break;
}
}
if (i == HASH_ALGO__LAST)
i = match_string(hash_algo_name, HASH_ALGO__LAST, str);
if (i < 0)
return 1;
ima_hash_algo = i;
out:
hash_setup_done = 1;
return 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册