Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3539009ybi; Mon, 29 Jul 2019 08:15:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhIvdLvweePAbxe2DAHLho9NKUE7OuxwAFOIYErODMIXVeKBxDCy2AXWtnO7KWsipniCGf X-Received: by 2002:a17:90a:380d:: with SMTP id w13mr110468275pjb.138.1564413344278; Mon, 29 Jul 2019 08:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564413344; cv=none; d=google.com; s=arc-20160816; b=VnQuuG+ma1EsmNYVDLFRZTK0W1xn2bmiYOIS1ue7veIeGKr4Kc/Mr6WpwXGGK5g4wE ADMebDdUK4njy87+QHLpZHigd4ho6fDvVv7bDzDWi1VrHePHOPvna4HspasizbenQ4A9 ljZYz3pG00huwG7IeizH2aTIjLGbkJAQX4IOfAEBBpqC2UBTVn0/ESdRW164+Bt3oO9h 3n2Vg2u9QFIUB2ddhzuv+siRIhRRGSJziWC2jcQyJJJgxEQWUgkerno9oZxdUAMuE+Ta kgC1WH8Ir5N/eagdzjLCRWKESivb/dq7PRNz1pG+YVw/WhoGfIG64s8neDLYkTIbfGgH 3Oow== 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=7VhBroyGxGn/uVVtotJh4SOBVCoW5vZobk9B4v8Ue9c=; b=FJC3eOMKMfKaCr5ErhFd88dqr3n8/CpdB0UScpi49JATjZQRjF9NOdgw5JQ2OuOLRw 7HFqQKn+aWB7o6JZZlwU/P79r3mX+1IY5s34yyY3QfcNVqJEmLD1GojyAJu/HTNsqeyX 5vntRFgUamAK2GSxvbUmvpB/8me5YZCnzOCmJH7Db7Vky8tQoT3gsoFrA9T9xvyvFdRo NvHnQwP8U8g9jUFadFg5+vhzcs10xDoZsaCRQ+v7MLdHvDIi+cWVmgTB+Z/9iqKL1Mwm pMc93IgEdP/v6fgSyQKYnLxXoBODIeoljqgZANNB5O5AViRfr/U86dVDxZvFBwEALkMN zZ4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=lXJjen3f; 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 31si26524495plk.342.2019.07.29.08.15.29; Mon, 29 Jul 2019 08:15:44 -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=lXJjen3f; 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 S1728721AbfG2POE (ORCPT + 99 others); Mon, 29 Jul 2019 11:14:04 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36917 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbfG2POE (ORCPT ); Mon, 29 Jul 2019 11:14:04 -0400 Received: by mail-pf1-f195.google.com with SMTP id 19so28191950pfa.4 for ; Mon, 29 Jul 2019 08:14:03 -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=7VhBroyGxGn/uVVtotJh4SOBVCoW5vZobk9B4v8Ue9c=; b=lXJjen3fN3Ee408KHLV8ItbVARbeeRH8QusB5XN/bdyL10ToU0zPjHbw3tviGvtmov 1+nuJmhnC8aZTaJuHxY8CinSweSTbWgDIBfm9tFwkmciqu3oE358dI5cpLuX6h/Iiwwo eMIebB6D0dGyb7ouKfTG+OCtjuJcvsub/TGjZwFGQ8aJJlFgBPGoKfTqSuXoLmEplv2p RJcXZz1s2jalkDD4vp2T+ZGURehXZJBl2TIUaxjwSTCimgAiFeii7jIJfiMA9VZKoXRL hWJme+SF0QE7L4CYCdA0Ixw9Cq/KdG8qqanqDX0lQnhtyfFcZgmXRF6ZtAolGXao8XD5 y9zQ== 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=7VhBroyGxGn/uVVtotJh4SOBVCoW5vZobk9B4v8Ue9c=; b=CpCZjGDxMOFIvwCjI8NSCQ6SDUqF01RjGil98jlhXQbTbIeJNeqWnmvq6k46EWo3mT FvPpv7WbHlpC4w/z2K2DOuu84rTBnNTCVoTjK6l3r3GORJR6kg2FDQlBizoMDMRNo/c6 jdRZu0qnLG/FLMmKm+XGcovvqNy0AputxBN5GG3en/7Sn+f8cgfhne/roCRWbiMb7kaa x6WfGAgmEtOI6ixoBnJ47uG/kLtWK3QlltpSRj0LmZgwDpmmc8/8C25lxlko7ONy8atG 0olvssmk42rV5d61pi4bGFZpdZpGj/6yr0lR57a5TMIvrbBkS1pU14U5dst89o6JW4KZ cb+A== X-Gm-Message-State: APjAAAWQ87Aa4iQiHgmHrfjQuJdkX0URwnI4tcEt0pXy6GARNjhp3oyw oadqbHdEp6YrdAUrryL/o+c= X-Received: by 2002:aa7:8817:: with SMTP id c23mr37633718pfo.146.1564413243726; Mon, 29 Jul 2019 08:14:03 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id i126sm73927399pfb.32.2019.07.29.08.14.01 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 08:14:03 -0700 (PDT) From: Chuhong Yuan Cc: Jason Wessel , Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH 02/12] kdb: Replace strncmp with str_has_prefix Date: Mon, 29 Jul 2019 23:13:59 +0800 Message-Id: <20190729151359.9334-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/debug/kdb/kdb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index 9ecfa37c7fbf..4567fe998c30 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c @@ -830,7 +830,7 @@ static void parse_grep(const char *str) cp++; while (isspace(*cp)) cp++; - if (strncmp(cp, "grep ", 5)) { + if (!str_has_prefix(cp, "grep ")) { kdb_printf("invalid 'pipe', see grephelp\n"); return; } -- 2.20.1