From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51C25C31E40 for ; Fri, 9 Aug 2019 07:10:16 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2705C208C4 for ; Fri, 9 Aug 2019 07:10:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qnGtnDam" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2705C208C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id F293BC74; Fri, 9 Aug 2019 07:10:15 +0000 (UTC) Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E2FF1C6D for ; Fri, 9 Aug 2019 07:10:14 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9F13476F for ; Fri, 9 Aug 2019 07:10:14 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id o13so45379812pgp.12 for ; Fri, 09 Aug 2019 00:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AfFInu/BKl5gok1YyMJiKglvG/hgOvmiC2oJHUZbiVA=; b=qnGtnDamMWxXkDvOfVvqZyiG6ESs3LPrdiIFipKW0wSvRvybAaPD6u37c/y+Acoxl5 WcyXF6qUzNvxq9ql7r5zVsKIrKNF6L629QOCJF+cMyfo8LL+m4L+kas/k9Z4REFndMw9 Ma/5yipfNJ0LrB5NNa4xGgCzqc3BNHGZ8C5CBQ6nKC5fULk8MJgDqoc6WSVQMGUTLNIi RWKkW5eTgoovXCx8d2pLjD4muWZYJdK4s1gfk+sDHLMVec5Zam0ER72GybKZGyuhS8KD W8ovG9Oe+OzKUSVXog6pgZmJDGg26HIq7jDbIxKADkCXHo0pjEpkXFluSrfOGAjLTkPv H4xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AfFInu/BKl5gok1YyMJiKglvG/hgOvmiC2oJHUZbiVA=; b=LNQyzQoazOzIlU95M1M4MSr1eT68eU/7vM26TfL6xAZT4rBiYRmRONunl0wKz6ZJyZ +zS67/Y2gHMVKXzi0K8uTMsvX4dyddNxOYmySIpMHF4GyJ+aiOnINcc5IvtBIDw3SfCy QRKQqLljBcmFawdq37PbtMBQwIHbPBsTeR7ALjRaBu3IX5pcXiX1+8cGNpMa5nw76RAe HXgqzVyh22SJrkbzGoavcU7Fz47Zd31z+PaNffk5BltRmY8SiuOd9gG1kAQDnql2cALG YsfA/E5pdq2WZdE1+VBryfYXsxpLg8/i7WG8wKWba+8Amzi2FIgXD6uu5SJvYd/mONrF omwg== X-Gm-Message-State: APjAAAXtKqVr+FjNxOh4qmyMIwLj4eIZ2Yhu/LnIlr2fYINiFvmm/zAr S4ZkD1J7CS2YJyQyvoH2E/Q= X-Google-Smtp-Source: APXvYqyCJqVbpv6emN3HFwU1RDjesGU99ywfAwLyfs9TJwWgVvpkgL6a+uXlTNL0WPBQjy2+H6017g== X-Received: by 2002:a62:1444:: with SMTP id 65mr19563170pfu.145.1565334614339; Fri, 09 Aug 2019 00:10:14 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id w4sm120886334pfn.144.2019.08.09.00.10.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 00:10:13 -0700 (PDT) From: Chuhong Yuan To: Subject: [PATCH v4 1/8] dma: debug: Replace strncmp with str_has_prefix Date: Fri, 9 Aug 2019 15:10:09 +0800 Message-Id: <20190809071009.17114-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: Chuhong Yuan , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Robin Murphy , Christoph Hellwig X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: iommu-bounces@lists.linux-foundation.org Errors-To: iommu-bounces@lists.linux-foundation.org strncmp(str, const, len) is error-prone because len is easy to have typo. The example is the hard-coded len has counting error or sizeof(const) forgets - 1. So we prefer using newly introduced str_has_prefix() to substitute such strncmp to make code better. Signed-off-by: Chuhong Yuan --- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index 099002d84f46..0f9e1aba3e1a 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -970,7 +970,7 @@ static __init int dma_debug_cmdline(char *str) if (!str) return -EINVAL; - if (strncmp(str, "off", 3) == 0) { + if (str_has_prefix(str, "off")) { pr_info("debugging disabled on kernel command line\n"); global_disable = true; } -- 2.20.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu