Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3540103ybi; Mon, 29 Jul 2019 08:16:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOVJlrAAy7ZtztAUiwQDj0p2ycXmsb1KGUJz61DvdMkL9a82pYcioP0Bu7XfvKRn4ylUTV X-Received: by 2002:a65:640a:: with SMTP id a10mr103280083pgv.338.1564413403041; Mon, 29 Jul 2019 08:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564413403; cv=none; d=google.com; s=arc-20160816; b=S94efKiX6Ffwdw8ZjJGKmyaJZkPrfvUekyZCB1YPeZrUPAUlQ+jH7taZ5PV0mvPrda mxnEONrPz/uuBxqGgd0YcIRVTTkSszLYWk5AsCpvkxWz62KIqIBllHIBMOZllyVrc8Pf rr9hLuNd/llcLF8cXWyxI3fgvCcnZVENAXVRt/CdW8nKexyyCFhQZ7CuEd3Pr6TH8Cw/ Yb0hbB4LxTza72DypQl8H6jgWMI5VUl+Uxrs7nbQfGo/wSGUYTWkC6f9EiodeSbYz/eT a58dQKbU1eJcjHm5NTB/tXh1djm+0bojFsapUw1n4R7I6RdbzVirMOfaqwHv+fmxqXVq 5HhA== 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=koA2wZvY1xMhA3KsE1/9Z0pBqrsMdAu4nwh2NZ9LbVk=; b=vNmgpNQlcudCOVwqakZ10Ltvrg98pVcNEUnRGwvnq7uaTjusvU/+CF/EIWxat38J5X Lvwu25ryKx9rc3CC4QfTOCvXG903+HOsvUJoTKiX86pmJXqyNR8l93KYmt0pAtwN5rx3 IJvZ5FVWUBbOJ/pwbU/uTB/JQ231Y9ZBh9m/a9hu2GKBhU+QorTQmUGeL4xKw2Zhsj2H odHjX17LLs0eO0bjjqZ3ydjvJuwXDEEOc68Mu8WnaufZG9aFO9e9w1A0tNF9Zsv06fYV ozYy+T1CD+bcPt3+qlXVNKRJaFEYyKI4T0MdOroyVxQ7B5scIDFQ66Ra9Ucn8zFybF85 R06A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=e4rzKkb2; 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 67si29068557plf.400.2019.07.29.08.16.27; Mon, 29 Jul 2019 08:16:43 -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=e4rzKkb2; 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 S1728817AbfG2PP0 (ORCPT + 99 others); Mon, 29 Jul 2019 11:15:26 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34380 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbfG2PP0 (ORCPT ); Mon, 29 Jul 2019 11:15:26 -0400 Received: by mail-pf1-f193.google.com with SMTP id b13so28199142pfo.1 for ; Mon, 29 Jul 2019 08:15:25 -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=koA2wZvY1xMhA3KsE1/9Z0pBqrsMdAu4nwh2NZ9LbVk=; b=e4rzKkb2RcZY6CXq6oqa9fgnPRCiI/und8SOuBoGXaRlBhhEJbekWH21nMrMJ8OqE5 nEcmwMn3FhROJt7eKaKQT9XxBjoqDQplHcQrPCYsnKjTo7pFQ8vQ8ESUdRvooqw2f49J EQIrBIbb1mlsWJI3sem1xKhmYQoiU51Kn7twObObN0/m4TCagI+wQOUIjXOUq3voR9Ni /K8PtiyKvPfMb3e+EVYVqbMBfkFaXurEfZDJcDPPGB7YkZG7qtLZNZmV87RNGDp942dD L3W5C83yrBxG5nBWdQRPC4KcCPvB+j4yMxVdYXp3FhXPIfOHAVS0BsNzxhmmj/zXCQML /66g== 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=koA2wZvY1xMhA3KsE1/9Z0pBqrsMdAu4nwh2NZ9LbVk=; b=HicXIjGdvEm8xgRo+FPHVNRkzLk/AIO9fVDZXxHj+oFHKroxaTDKV5epar1DRjq5p0 hLwhXl77lR5HkJ9rHP0D1/iDwuEpm6cTRYjhFp/Hm2FqDHjnyOg0Fe9VH13fu6+/vw5G gNGRZFfQEjqnwYq52eGe7i5A2oXtkGjhXUnQMIWzxdaArGevGNFENUuN6pZpMHvsyj2m 4PnI0Y9mu1DikJOwAzmdPFGUOu51Z/PQnNzeNqvlLLGoTE62fCOIWzOxUp3QE0ty3fh5 708fJAZgZib8CcSp53933QVzAbKvopUSCZWicFqpgEL7uuQM5sBKeUBbwFIUfik+JcvK Py2w== X-Gm-Message-State: APjAAAW9tGbQUhXVwImbiPilfoWtn/uKJE/3pOsTJx7HH5NWrUSXfNtF cba+mxg2HVpP6+BlFpyBENWIK2XPv4E= X-Received: by 2002:a63:20d:: with SMTP id 13mr94245627pgc.253.1564413325640; Mon, 29 Jul 2019 08:15:25 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id o128sm67667764pfb.42.2019.07.29.08.15.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 08:15:25 -0700 (PDT) From: Chuhong Yuan Cc: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH 10/12] sched: Replace strncmp with str_has_prefix Date: Mon, 29 Jul 2019 23:15:21 +0800 Message-Id: <20190729151521.9768-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/sched/debug.c | 2 +- kernel/sched/isolation.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index f7e4579e746c..6a77bf51e4d3 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -103,7 +103,7 @@ static int sched_feat_set(char *cmp) int i; int neg = 0; - if (strncmp(cmp, "NO_", 3) == 0) { + if (str_has_prefix(cmp, "NO_")) { neg = 1; cmp += 3; } diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index ccb28085b114..cd5dfa93095d 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -143,13 +143,13 @@ static int __init housekeeping_isolcpus_setup(char *str) unsigned int flags = 0; while (isalpha(*str)) { - if (!strncmp(str, "nohz,", 5)) { + if (str_has_prefix(str, "nohz,")) { str += 5; flags |= HK_FLAG_TICK; continue; } - if (!strncmp(str, "domain,", 7)) { + if (str_has_prefix(str, "domain,")) { str += 7; flags |= HK_FLAG_DOMAIN; continue; -- 2.20.1