From patchwork Wed Jun 28 15:33:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13295958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16DDFEB64D7 for ; Wed, 28 Jun 2023 15:34:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8FE948D0002; Wed, 28 Jun 2023 11:34:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8AF028D0001; Wed, 28 Jun 2023 11:34:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74FC98D0002; Wed, 28 Jun 2023 11:34:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 650518D0001 for ; Wed, 28 Jun 2023 11:34:27 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1F56F120B12 for ; Wed, 28 Jun 2023 15:34:26 +0000 (UTC) X-FDA: 80952553374.03.A6BDF4A Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf18.hostedemail.com (Postfix) with ESMTP id 8A0481C0020 for ; Wed, 28 Jun 2023 15:34:23 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=H2xRYP64; spf=none (imf18.hostedemail.com: domain of andriy.shevchenko@linux.intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=andriy.shevchenko@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687966464; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=QUot3id03Fi4Q0nI8wc0vO323eixpfAxso0J0rUzMvU=; b=03cY5+9rG95OvTKyG/qIahsRjUWxWRKZnP3s/+VNioVoCuHmricFRHaAGL/A6780Vt3jO9 qt/b4+4FwI+U7sw9YFT1upyTcR0HzA0ZhKcvn86YEOVHiiZL78WeXy0lBwWZupo2YkNGZX ZPXCPqcbmE8N+Ut6yRPAWTFFPntmexU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687966464; a=rsa-sha256; cv=none; b=BT49eQtTpo9f6bGhmLiWGrcj4I/AP+5FC/lbSk3ov4lPJGrwolma7QUMf/1THhu6IrMi2+ 9ltsVZkp49QzXE6E5+JMuHH9q2lV/pMWAnFO94hQuRGwFWsLN4PFzu3KvpCD3NG+QemSlM HjduqzMcPSllMAIqb6AAO8rNPRoDnUk= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=H2xRYP64; spf=none (imf18.hostedemail.com: domain of andriy.shevchenko@linux.intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=andriy.shevchenko@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687966464; x=1719502464; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=UM29w6YmyINBXCk6A+fAcfZ7rP6qST6yVT5akSdbQhM=; b=H2xRYP64CS4rOszoGQMkZ2eF9bLR265lV0KGOh7fvZr6fp5izY9W2fcM rCI474AEWrLR5KqiD9eor6Tjwrvnb+3WikqXrKB6Hu0vD4Z4XBkIXBn++ d1Ys3d6aZdlNx1nUwlUNJhZwJ0wBiRgpWZdI5jYj2jaBzNou9J5mRyb4A Co5CC5tjd992PmW8j+ZKZ7HiTaHl5n3b+6H/n4ha7p66gyCKjKGhRMf5s XtIaAalZ64loX09iY5XxF+98W8xsDlcfJwdMLMkuiIhcz1WkuagRa75Il u7VsW9503SJGS6R5tQQEihp+cgGhd4xOPPypRbPt1eakmlom0SoIGXyOX A==; X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="364427618" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="364427618" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 08:33:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="782344837" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="782344837" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 28 Jun 2023 08:33:47 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4BDDDE1; Wed, 28 Jun 2023 18:33:48 +0300 (EEST) From: Andy Shevchenko To: Andrew Morton , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Andy Shevchenko Subject: [PATCH v1 1/1] kasan: Replace strreplace() with strchrnul() Date: Wed, 28 Jun 2023 18:33:42 +0300 Message-Id: <20230628153342.53406-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 X-Rspamd-Queue-Id: 8A0481C0020 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: fp8zd49ig1wboozo415rg95q7px96ix6 X-HE-Tag: 1687966463-440299 X-HE-Meta: U2FsdGVkX1+Z3uFX8XcTdKtQlXT1OSIL2QHvIkrDPHcsn1jLdqFPl+PnoXNpqNYil72f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C9KQZz9KT8wxUF+JOV6jksbiZA5j0WcKMikfwe253q0Ga1NYx8XPd18iOa027XB9ZVianq1xy4zQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We don't need to traverse over the entire string and replace occurrences of a character with '\0'. The first match will suffice. Hence, replace strreplace() with strchrnul(). Signed-off-by: Andy Shevchenko --- mm/kasan/report_generic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/kasan/report_generic.c b/mm/kasan/report_generic.c index 51a1e8a8877f..63a34eac4a8c 100644 --- a/mm/kasan/report_generic.c +++ b/mm/kasan/report_generic.c @@ -264,6 +264,7 @@ static void print_decoded_frame_descr(const char *frame_descr) while (num_objects--) { unsigned long offset; unsigned long size; + char *p; /* access offset */ if (!tokenize_frame_descr(&frame_descr, token, sizeof(token), @@ -282,7 +283,7 @@ static void print_decoded_frame_descr(const char *frame_descr) return; /* Strip line number; without filename it's not very helpful. */ - strreplace(token, ':', '\0'); + p[strchrnul(token, ':') - token] = '\0'; /* Finally, print object information. */ pr_err(" [%lu, %lu) '%s'", offset, offset + size, token);