From patchwork Sun Aug 18 21:01:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13767623 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 542FAC5320E for ; Sun, 18 Aug 2024 21:02:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D907D6B00A7; Sun, 18 Aug 2024 17:02:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D42CF6B00EA; Sun, 18 Aug 2024 17:02:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE1BE6B00EB; Sun, 18 Aug 2024 17:02:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9E7EA6B00A7 for ; Sun, 18 Aug 2024 17:02:53 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1FF80140E34 for ; Sun, 18 Aug 2024 21:02:53 +0000 (UTC) X-FDA: 82466590626.29.C90FE95 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf16.hostedemail.com (Postfix) with ESMTP id 4BA8D180003 for ; Sun, 18 Aug 2024 21:02:51 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=l0vsL4lO; spf=pass (imf16.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724014895; 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:in-reply-to:references:references:dkim-signature; bh=IBL96drYSuoCdxGZV7Oeu8x351yRAla81LihXM7ATxg=; b=etpHsWR+IaxPvx1aY3T2jRmZda5/34aIQCzR4NqRMRmd28YQutHH82EkTx3ofktm20sVWg yor/K3scDynUsemWgUiIJ9rGulumm8fZ/krxLGLmh758kVGyrYOpvLxhOHT2tIKHK0AJCk InJtc6J6j799yJuYQUR3qUQVulV3u1k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724014895; a=rsa-sha256; cv=none; b=B6XDSyC2M7ygmdbOD1MJgO6sn1z7N4pLI7HmdSukk7Y0EkIimVkGz8V4fRA8XMomBdIUXB crj5gwH1AcsbrkebiaH4zEICpaJw/mySZx0nLBOFMxj+kmaXNxBFZmzvL5zFRlZuv7NYXn BdMw7MTZmQoX/L43gqW313yQeWgb084= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=l0vsL4lO; spf=pass (imf16.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a7a9cf7d3f3so459620166b.1 for ; Sun, 18 Aug 2024 14:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724014969; x=1724619769; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IBL96drYSuoCdxGZV7Oeu8x351yRAla81LihXM7ATxg=; b=l0vsL4lO4+L6LmxrDcroHhtkRtOEC7kwPIcEtcpwicJL78ILdigPheVEVdn2CAjREL /JB5AArBSJJgLCagCtfNMNDaRYg6unbTO3c3N0FcbLAQZGMAwb7YM9hvnQSpxjpOM3fF o+4ZqgMQXYT99Mks5W4ajd4Ix2CratS+aL1OBmztO8TQaMU2FzLzzZ7P9gb0xCR7rvVr 18ODI9N0SjfrG2WQtpLHQ70cXySisqWkC6xML4MbudfWWx0Nb+RHBC8ZLEPTpvRs41aA dY4TcDSWEvHqfp1c0W7LiP5BRbi8+ciGlRS9iVX9xdE/NFbE857mlr66IZW5xtrSE9kM /8iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724014969; x=1724619769; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IBL96drYSuoCdxGZV7Oeu8x351yRAla81LihXM7ATxg=; b=W6kPnp3GtxQa/aPUte6+CWMmeaZOn7AjatC4uHCXfyHlLayjbGbQkkzXObmDH9+n1p 2VVzW5UqUBiw0LUPooze0FA1Ze2xh217P87qawDhzhG/NTPQJVa9o4uTO2v7/9nRYWKZ N7fr6+RLMq5d9VRKJt1z1IliprmNL86U+RkT8DKl6yGcHD8FX+NOHflTDu8Th5njeWmX YVKoNtEQ/1OQzc7MsDMXFX0bQmGgRz7Do2zH6oETvliadUdb8GF4T0V+LegGdtIRtYWn +Z2YvpkakibZ4+oj6Gob6dcn1Jx9vXQ51ijcZs+vOXRIsmD8b4LbweY33iXWGiNOz+xa ca7g== X-Gm-Message-State: AOJu0YyzUIx7a7NSgy0ukXKxvYSl9UCeyrql7Fk5dMK+fgHPZxoUzzdy k93Venzy+K7walKkzF+wPuUG2kvXze6NkrWbpVLVfaLuE2DJ64yLaHVpAQ== X-Google-Smtp-Source: AGHT+IGaRA6V0RqJu1NK84ILI5ADVTm+Oy+tgaxaQutwadRkt+b2L4mLzehwnrGD21KawqEWePr3pA== X-Received: by 2002:a17:907:6093:b0:a77:db36:1ccf with SMTP id a640c23a62f3a-a83aa0a0587mr325441066b.42.1724014969123; Sun, 18 Aug 2024 14:02:49 -0700 (PDT) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a83838cfd5esm552895466b.78.2024.08.18.14.02.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2024 14:02:48 -0700 (PDT) From: Uros Bizjak To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Catalin Marinas , Andrew Morton Subject: [PATCH v2 2/2] mm/kmemleak: Use IS_ERR_PCPU() for pointer in the percpu address space Date: Sun, 18 Aug 2024 23:01:52 +0200 Message-ID: <20240818210235.33481-2-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240818210235.33481-1-ubizjak@gmail.com> References: <20240818210235.33481-1-ubizjak@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4BA8D180003 X-Stat-Signature: 1ei86kj4wmdxaucm3e9qpiyx3j4jszdm X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724014971-826039 X-HE-Meta: U2FsdGVkX184H0G2eR4Yb3MfSjs5E5gbV8PJDebXzRFcseAINXAj+3ggfTimhMhsZK3Ko/LXxaDcDPZKtclKaJJbkCbKwyiNqcLnsPKj6qBl3oHlBgcIEe1QzsqXqPuugkiS8aJnZE15wD1uTqqA6iWvSu+mc+qQ4p/RwCRkmSfBuYLzi2j4DEsQPoeUrwKK97+s6/n4cgTEhqzFSIRywdZH5Z3scePIKwWTijrvezpp1cbk00V8XGCDN/nf91Vb1EtwxjjZilMotgeM/hveLGaJIkhQF50g6nazY+26EgRFAumxvxdJA1PvGka1ycOzHRuN5rytTgTBN4QqGWfKDsjgYX+2F3+cKRPae/+GNpcKKaYj/03CgdelGCHrPVGbQ6pMtDHAQzCb/jF6Tf+Xo/GXzWIM0NA6tmfsBE4t8OPDxNK5WfbOgpIuTgUCB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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: List-Subscribe: List-Unsubscribe: Use IS_ERR_PCPU() instead of IS_ERR() for pointers in the percpu address space. The patch also fixes following sparse warnings: kmemleak.c:1063:39: warning: cast removes address space '__percpu' of expression kmemleak.c:1138:37: warning: cast removes address space '__percpu' of expression Signed-off-by: Uros Bizjak Cc: Catalin Marinas Cc: Andrew Morton Acked-by: Catalin Marinas --- mm/kmemleak.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 764b08100570..fa468809d043 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -1059,8 +1059,8 @@ void __ref kmemleak_alloc_percpu(const void __percpu *ptr, size_t size, * Percpu allocations are only scanned and not reported as leaks * (min_count is set to 0). */ - if (kmemleak_enabled && ptr && !IS_ERR(ptr)) - create_object_percpu((unsigned long)ptr, size, 0, gfp); + if (kmemleak_enabled && ptr && !IS_ERR_PCPU(ptr)) + create_object_percpu((__force unsigned long)ptr, size, 0, gfp); } EXPORT_SYMBOL_GPL(kmemleak_alloc_percpu); @@ -1134,8 +1134,8 @@ void __ref kmemleak_free_percpu(const void __percpu *ptr) { pr_debug("%s(0x%px)\n", __func__, ptr); - if (kmemleak_free_enabled && ptr && !IS_ERR(ptr)) - delete_object_full((unsigned long)ptr, OBJECT_PERCPU); + if (kmemleak_free_enabled && ptr && !IS_ERR_PCPU(ptr)) + delete_object_full((__force unsigned long)ptr, OBJECT_PERCPU); } EXPORT_SYMBOL_GPL(kmemleak_free_percpu);