strncmp(str, const, len) is error-prone.
We had better use newly introduced
str_has_prefix() instead of it.

Signed-off-by: Chuhong Yuan <[email protected]>
---
 kernel/cgroup/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/rdma.c b/kernel/cgroup/rdma.c
index ae042c347c64..fd12a227f8e4 100644
--- a/kernel/cgroup/rdma.c
+++ b/kernel/cgroup/rdma.c
@@ -379,7 +379,7 @@ static int parse_resource(char *c, int *intval)
                        return -EINVAL;
                return i;
        }
-       if (strncmp(value, RDMACG_MAX_STR, len) == 0) {
+       if (str_has_prefix(value, RDMACG_MAX_STR)) {
                *intval = S32_MAX;
                return i;
        }
-- 
2.20.1

Reply via email to