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/irq/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c
index c1eccd4f6520..85d1e9aeb8ea 100644
--- a/kernel/irq/debugfs.c
+++ b/kernel/irq/debugfs.c
@@ -188,7 +188,7 @@ static ssize_t irq_debug_write(struct file *file, const 
char __user *user_buf,
        if (copy_from_user(buf, user_buf, size))
                return -EFAULT;
 
-       if (!strncmp(buf, "trigger", size)) {
+       if (str_has_prefix(buf, "trigger")) {
                unsigned long flags;
                int err;
 
-- 
2.20.1

Reply via email to