Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3541329ybi; Mon, 29 Jul 2019 08:17:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJpw399/8BZ6clI1NFl/iX4DY8jy6244RH3xywgLmhSEyp7ETPvxIomR4gLjbBG2Un2Bpt X-Received: by 2002:a62:e815:: with SMTP id c21mr38632368pfi.244.1564413467236; Mon, 29 Jul 2019 08:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564413467; cv=none; d=google.com; s=arc-20160816; b=AnOGJriLay/ASF1tUI88DZwomcVpiRE6vv66qPyvjH47W0idnLeKl160jh5gRss02T klkW+P2B40zf+mKfpb2Dfds52Y45WpUom570XOArMr6n9O23FDTy7KNZSGe3uL6V8NVT 2QTyTUNG0C3nWLBWId8/uOZdDge6n1QR6WpkRHOaynsaCBH1W0S9aGqbgqDeX9mP/wuj BlAuBtsjdb/86POsWEyYAR6Z0Bwc3a49lEZKgtK0Hj06KvcTTPQgZ6X+6ciWGduhbo58 RVZor5xh6RKHk73hK6UgMC11wRDUnrLu48cbTDqYGbN7BX0aN/kOj53FDLaObXLS52l/ lQEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=woIVuR6VRVNLdq7Fj1cmViScb45LHJKHE4rmpevHnO0=; b=egBtSH4QqcdQFP0hTBm+WWvBQKAN36IOYqrWnbhZt0L+IGBaMijrOj13h7Vb4EQVF6 xhZCwJMaRfsSSRy1qGmOqe4H40qvqzVrcPW4tPdrz2QUF455g3nDTTGUeagxn6W3QUHJ je4pVOZR3ZGx/5yXNebL4LdAEFY9zE6JFUzWlSJO6eI9McoHlmGi03Ixfb54E7Q1jn8b 129xKuNQ9p41wT8AZ+yc9YddbHj79oKe1jAZ2QwmRwF+T6HEFmT/obrY9RRj3XuP2+Ut bk2yX+BKkt184chPJTDqzcuOcebgKPZtJsOUHQfcunbKjCaHR8b2S2njO4laWb2TUvPh /FTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="YLnp/uOV"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s18si25346236plp.128.2019.07.29.08.17.31; Mon, 29 Jul 2019 08:17:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="YLnp/uOV"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728806AbfG2PPR (ORCPT + 99 others); Mon, 29 Jul 2019 11:15:17 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38851 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbfG2PPQ (ORCPT ); Mon, 29 Jul 2019 11:15:16 -0400 Received: by mail-pl1-f194.google.com with SMTP id az7so27619345plb.5 for ; Mon, 29 Jul 2019 08:15:16 -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=woIVuR6VRVNLdq7Fj1cmViScb45LHJKHE4rmpevHnO0=; b=YLnp/uOVa1Wbp1QzU8U044HQkPekYyZ+LBPl7SyR1wyiYZk6zP+JGAKWo5Fh/xgw+J l0CXkxTfVrtA11MqtsAdqKOUvQqaoNq/C21gXsoNkpwT8e3moFlPuctYoqQmJNZlhzHj i/KNpWc7Nv6HIiisMZB0SDPOHwLLxCG4PlBOby1uint94lTi3YLiz2lZEjdiV0atDsf8 2jjULtn4rhODy9t3gRU38UAUDVumYScZ4B8dY0NBSPOj1oNqfCJoqcOQzTCsX1fYq7zm dfNVZ8vrmA6gsZXSMuTQWbqUmZj1bJn/OrlvnvUNKV8dyWB7qO16VRGke62Tj/SpfXiS j5hw== 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=woIVuR6VRVNLdq7Fj1cmViScb45LHJKHE4rmpevHnO0=; b=PcFEHP3+qxGeRaeXOXVgyE4mxxaTjTXTPBGF8XNdHp9sS0xVXDmSB60CcXO+A+9pVN 9dSRuh3DdtXLJBBlYC8W5DvcXs/RdBgbdmki7lha1gBhKA77913robzXyEz2rwNu9uFC PIHVzRQJikMS+Wa2x0TVhw1jjuCemrg6sYxmaqztr0BEfScR61NdiDHLEri6ej2QShFS IuNULzzYE7qUt89mOT9sUK2FzTcd2vrvGD2CM+zG5XHa7YEiBpd2XzE089nkJxjmmqsR GZTEACWjI/bQCNyJZuM/fcln7O4iclpE8aKMHWDjwOp+U78X2vvrUvj5mLKGx1l9maTF TW2Q== X-Gm-Message-State: APjAAAV2pQ35gIR6psVfMrHg0Bz+RD3uXv9afupy8LXbWc1VobQASnQq MZJwEVBARKvk423LnvnYSify9Yje92Y= X-Received: by 2002:a17:902:e582:: with SMTP id cl2mr111588055plb.60.1564413315877; Mon, 29 Jul 2019 08:15:15 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id a5sm53659586pjv.21.2019.07.29.08.15.14 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 08:15:15 -0700 (PDT) From: Chuhong Yuan Cc: linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH 09/12] reboot: Replace strncmp with str_has_prefix Date: Mon, 29 Jul 2019 23:15:11 +0800 Message-Id: <20190729151511.9714-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org strncmp(str, const, len) is error-prone. We had better use newly introduced str_has_prefix() instead of it. Signed-off-by: Chuhong Yuan --- kernel/reboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/reboot.c b/kernel/reboot.c index c4d472b7f1b4..88098cf922b8 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -530,7 +530,7 @@ static int __init reboot_setup(char *str) */ reboot_default = 0; - if (!strncmp(str, "panic_", 6)) { + if (str_has_prefix(str, "panic_")) { mode = &panic_reboot_mode; str += 6; } else { -- 2.20.1