Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3538976ybi; Mon, 29 Jul 2019 08:15:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlwCA4wkdTPEZeUO9sEZhnKcJ3yMHDfxv2Ds6NyGLOSV4xBb976Nv/SPevCZYwJmhgbBX6 X-Received: by 2002:a63:e5a:: with SMTP id 26mr101029240pgo.3.1564413342348; Mon, 29 Jul 2019 08:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564413342; cv=none; d=google.com; s=arc-20160816; b=W4sviQMENRGqXQ1LFDx+V6cz9P/sV3T/Vnh/xPnEoB1hdfjAc1k6AjT68BT0jHX1be mUM65uv1Ngku2NRBWOp54U7wmBXDeoBPpmot/WJMgcfehOR+aT4eEvax0OX3lkzwwXi8 vL2Yvl31igJRWYdFPPreexYkCRvXxpI4VHXhmLl7u9KBBxHazWrgjW3ovUptTLAgvsZB sstH3QYj8QHchYFIga7/dUaG1X1pruKCEHcRFJxfpquuO4uOyUtHEXfrAQVvY8by9R8t TiIAS/1f9njICrppzOBgOTGq5dGfpPOMNa552ad/Tj+/WbIHffsm+Y2gja3i9IIx3Df9 xVDg== 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=cE8JJxtzOsAV8bSA3yfUSxM/sHfO/Ip7c2TSFLIj6es=; b=GwNKDxGkiRgCHNbCWWmCADV5yjPK1ekx2CVV0IYXeRjHCKDWJT7Iyy5QjeeEiItxHt UQzUkDxZT/z0gyH+D/VoDhR1XZlcx5yPoQLHmZoN4J4SNQOHhLkS/+hto3W3+JwQugyp PUR8UcO9p/lrk9kubSpF8f/GcEDoThVqGex+PLtr+VyofZs19C9+fU77HhwiiYslAb9i juYcQMBolTigl6J6cgMeIy2BwDibyHXDi4Iu2l7UD/Zc7ukrUZ8KBs+7hfSWSVX4k8x2 4HxMckTNeTixt+JI/BWdLfFbJeCEWf9W9VpBDbDZSRFpp4b9IPu+rMe1HygYFAfe1S5Z 2uLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=lShzhUhu; 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 c7si29584170pfi.253.2019.07.29.08.15.26; Mon, 29 Jul 2019 08:15:42 -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=lShzhUhu; 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 S1728746AbfG2POd (ORCPT + 99 others); Mon, 29 Jul 2019 11:14:33 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:42314 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbfG2POd (ORCPT ); Mon, 29 Jul 2019 11:14:33 -0400 Received: by mail-pl1-f195.google.com with SMTP id ay6so27671222plb.9 for ; Mon, 29 Jul 2019 08:14:32 -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=cE8JJxtzOsAV8bSA3yfUSxM/sHfO/Ip7c2TSFLIj6es=; b=lShzhUhusv0TF61djjEp7G7d22h1fWbv2TyRJy4ZrLohIbqj47WPUfaA7UwD7fUxde 44R/F5rdG4Xmq/hSpfmGAuHGhp75pr3PmmRMF1++ZSKOuSDZM7GB7KLGaQbhGfY2eUBx x6donM7ZNlI3gpsA3k61hHjrGFDrQqWZbnZYA0Edyo6ZhjSpWiVHVsq7/6f0SvzqDoYF I9Ty4ZkLJv5ewuAAtkdKQwMlVOYuRdoDxHpCclQzqtchrjK658i6CXcsRgc+ei5j3HG6 Czn5kjnMpo9cSvgkq5rVOHBvL12e7VgbjUEhu0Jz4dWXZJ/epZi4P0TXfIBuQpMYa3b/ Tbcw== 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=cE8JJxtzOsAV8bSA3yfUSxM/sHfO/Ip7c2TSFLIj6es=; b=pVnJ5Iw7OF2VQG+0X0/za7f/oruIrg3WmMjV0J2sFlt7gKnHAdrtEREDQ5U3d1FAjC AaI6nBd6uhn539SbqhkgSVG9sjSgzCrQgUxCnhNihen7CyuKo1t+/rCGy6nCKfpQ01JV OvtAkzbk3Yr5N6N3TCyeSMdz1fE1xNJVMxKbFZjYNZAdGbvlT1gZJ665eRKpvKOeV6ZX hWSF7+kTnKaoIxJ7zCNQ0ss8ja5usMvZ9aq5RjgzD2FriXZC1HkU2eGfolT0UIkuXViv sQRTwNS2VBxwDpaXnChFT2NG8F9yIuECOUcxy6LtT4kfXxXiRhHCcSfxPw1LMe01NhM+ jH+A== X-Gm-Message-State: APjAAAW9OkEyTJ+M0LC39hnfB0bKu5XtV8te5+QvXc7lX4N5LfhYcaSg HAWw6bLx4mNAkbxsKMTen/Q= X-Received: by 2002:a17:902:2a69:: with SMTP id i96mr109374810plb.108.1564413272485; Mon, 29 Jul 2019 08:14:32 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id 195sm103728065pfu.75.2019.07.29.08.14.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 08:14:31 -0700 (PDT) From: Chuhong Yuan Cc: Peter Oberparleiter , linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH 04/12] gcov: Replace strncmp with str_has_prefix Date: Mon, 29 Jul 2019 23:14:28 +0800 Message-Id: <20190729151428.9444-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/gcov/fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c index e5eb5ea7ea59..67296c1768b4 100644 --- a/kernel/gcov/fs.c +++ b/kernel/gcov/fs.c @@ -354,7 +354,7 @@ static char *get_link_target(const char *filename, const struct gcov_link *ext) */ static const char *deskew(const char *basename) { - if (strncmp(basename, SKEW_PREFIX, sizeof(SKEW_PREFIX) - 1) == 0) + if (str_has_prefix(basename, SKEW_PREFIX)) return basename + sizeof(SKEW_PREFIX) - 1; return basename; } -- 2.20.1