From patchwork Sun Aug 18 21:01:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13767622 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 18CEDC52D7C for ; Sun, 18 Aug 2024 21:02:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 358B96B0093; Sun, 18 Aug 2024 17:02:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 307166B00A7; Sun, 18 Aug 2024 17:02:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CF686B00E8; Sun, 18 Aug 2024 17:02:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F1ACF6B0093 for ; Sun, 18 Aug 2024 17:02:50 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8F3D1C0DAF for ; Sun, 18 Aug 2024 21:02:50 +0000 (UTC) X-FDA: 82466590500.15.25D5D79 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by imf20.hostedemail.com (Postfix) with ESMTP id CFDBE1C000B for ; Sun, 18 Aug 2024 21:02:48 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lIw2GjIg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=ubizjak@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724014883; 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=33O1tYB6ZBAM92pkyxt8k+zeN401oztTnBh5GARjIPw=; b=GmfzLH86ovG3T/k2ZHasZnn/mSjoHLcp7yyabZ+H+VOIOcLXP9kUMiV+PYwaq7TpTfsxS2 ULQxH99zDHPRqu78OQRDZJGhG3x4y1t94eF+KVtsQIOdzGtQEzE4inqy3IpQX37Ma9WKp9 aKDsaf3CmvJu1L8FgGftCBZaiaxZRmA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724014883; a=rsa-sha256; cv=none; b=s8u5mkGVHrUYP8a5uD+mTlPYE7/9E+psUNnQl9Z8OKUN5NzEdHP504HUxW9ogdvs95u0OK 6/OKgrm9eCTtmCvAoYHsw/o3VQUTllcR3u5seKVK606fc6WZ5A1gI7X/IsQic++YnCMJ7I qteu9cvqinhSNwRgiIC3PB8z8lmHoWc= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lIw2GjIg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=ubizjak@gmail.com Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a7aac70e30dso397518066b.1 for ; Sun, 18 Aug 2024 14:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724014966; x=1724619766; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=33O1tYB6ZBAM92pkyxt8k+zeN401oztTnBh5GARjIPw=; b=lIw2GjIgm3wKa/0gOP5bi+hvwMHL1hyO/IdcbAQAulNrTP22uH6ShYCyB44HYsJ0LJ npQSKT9Hmge8RIduGJ3DSoeFVvUb3PN27Hj4g5Gmjy8hKuG6iPnnQfs9I3EaQJHSCs4I wvcOncXzFueCA7QC67D/CCkWOaLx/Zt+SeKaVeh6SG94rB4O7kRrgmjvArpwyQ9djbCf UzVaH9YVLi1Ban7Xum6fkHRnT+Kv6aH//3HZW4rIttqduvpGeUdmOwt6DoWWMWcyuDQ1 1OFlSkMUZ2YJ12uKaEtVIbcSnCYFxeSC4e+ebwq28weZk9rP32L2qS0fuCCr7ir7Hx+N UDRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724014966; x=1724619766; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=33O1tYB6ZBAM92pkyxt8k+zeN401oztTnBh5GARjIPw=; b=fpI6RE3INyMr7rI7wxoIe07rGyWhb/PiJ5uFNEYF4t9yCgulVGoRrqVdQ/HInQ5MD7 yJL5i24QvF8YWdMlOi2MMlHZD4tgEopDtt6jK45ac0WMY1QCPsDgHiewjnReBEUNls4d 8hrht1v28/7bl4otjBxxvMUa48FfpxP1W7EtRiWTjsCd7+0+lpKuO0omQwuE6ZW5oCng x7lRf22hnzeay6P4h3KOBB4qruTjLYaD75Cz/dg7kSntVf90lz4FtVg/cFxc9/sC7ym3 8fW0hnukcT5znvkeVLeRgy0Vej2eMyOgnUTJrYH+D5vXfPUStiCtjtc1RliZexBbm8Iw HOpg== X-Gm-Message-State: AOJu0Yx0n2gtT8w9//zvAv+783alqLeqHfprgH5RU05aWGEvnwA4Axyl AxhoPN67fGPh8QdppuM9t6dnC3DJazfpFZ9eM83MR5gMVy37f7YYmDNesA== X-Google-Smtp-Source: AGHT+IF37pvsOxU6lEpKmW36ULokTE+MkxkHNYwoC/m53vY0l2IHld/cLjp0yLPclo9BZHAmqKxmKQ== X-Received: by 2002:a17:907:3fa9:b0:a6f:4804:d41a with SMTP id a640c23a62f3a-a8392a03a86mr642953766b.55.1724014965736; Sun, 18 Aug 2024 14:02:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2024 14:02:45 -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 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() macros Date: Sun, 18 Aug 2024 23:01:51 +0200 Message-ID: <20240818210235.33481-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CFDBE1C000B X-Stat-Signature: dzp9ybay7o5q137gzjir8afnwuukkzpo X-Rspam-User: X-HE-Tag: 1724014968-199139 X-HE-Meta: U2FsdGVkX1+EKjwxvZwkpIArnGaUJxhjFdyxhZMGHC9tsPnANGR2TDFmLt4g5sal35TaupnmdcuHMTQdxGHM4/jSKesXoM8JvofKn1WK/vCH3nDSaY11xNg9fSaDwGRz2Dq0dAhK21LvFBKH1naZKLZ0RoqUJBEEqv9r+k9qa2oHW+sP71cfgb2bzBrISy0KiaqUYwMyZpyOlYK4oFT9h65n/6wfvw2CRMvX+QFkZzAxESLUFfT2Y67LZTPRB7YoN1Vq4uz4zXoOIX5OAvXc6645d6b0sYmBZpCRQ8W/jK6Muvq3eepLOjiieAzB37aXN4TLfZULgsZBkLCnn8AOzwc7fVqNFs4kLxc2GTOUG58OlrTeIjZn4vRlBeEzqiYy5QRkRNY8Jw/ylFyCOdO/y0ERYUIX+MFRW5kXpQrKZzMmr/bmt97ONa1LZd5TdthJmUUlhRMm14SlrhigPb2GUqVDRlaQRejNuW4qsgSVpPjzkJcMPKVAfHZxgWIGSuhb0w9/UVOeBNmiSf6UneSoiPyHCgF3HJpHXLFQooWcBZm4uZxSk402jZSih9YMrVPTGbklE/hBmTG8dF+URULUE+nK/OqZeoZ/Gd97fGkHSY95ILIz4NEfACYdxR1tnzf1lLDEi61xf1NYMsDo/apONKSEDCdSh0uOg6t00kLYN2Zn2s9WF3m+DtqgIu+jpIjiBTt3N8nY7y7BuM4jxT45swwrfpuwncJYHw4HCfq1sBEhDY7BsEf+UARcXoYT6dK/xraTaOy3oSHp1QH/W77R8+pu7vyudxbJrIJzscc0L1OLrhbdrgrjaVhXaZQDWJO13iy5h8WQrYYFo7T+/iTrhd9S82Xil8wzYIcQlKykrViZlaOYLGv1rhi93oTU0FR6nbQHgoYWGGpKeJX0kpBUCDRjZgV4c8AuSI6Asds8CCaJU4gRYtC9hXyDOOzuIt+bToRWDsKbqWw23eCFA+1 7+gLGrtf QjXMg+0/bOQZRExLHhizbTg6HX2r7EDG8eieCO+HhINAgGWESThBMrFg4PQOj3pNX+yWFXNr8+SwCVZeZn6x8BlRE4ZxZd9pzlYdP63GjZCpJBpApM308+6j6S3N+BRjn8wC9Tek5chHSc37zCRFZdbk0cFsufI43psOinSIdzEArhLuNxq8qFrn1KSzvEpy/cgZyUNhXsqPmzXHzHFDQG6OL6rOAnbr1Y3qccd2qznytLypbC6/kfG5cMWyNqku1ef21NJGAiL7jAOg3qTQi9Efss/9y/yfHgqvnk00DFxwgiBc4YjNZAWHbKnpm1REA8HOw4GNAW7VOtTaebYTUiU6zFs4l+45c7tt/73MEiCH5Taefc/8nf/42dTRlmoLIkbn7Rb+EeFtlnF4VoqnikezEScI6yk9K9GpGUJTJzfxTW7vIrE8ziZZBzapv2X4CNv+ksa9zH0JcHrZcdIf44B8nEAWmYX7KdqIhEbXIzkJ+VPY1lBxhnFnGtPF4stfaRitQ51XOW+rJmSY= 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: List-Subscribe: List-Unsubscribe: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() macros that operate on pointers in the percpu address space. These macros remove the need for (__force void *) function argument casts (to avoid sparse -Wcast-from-as warnings). The patch will also avoid future build errors due to pointer address space mismatch with enabled strict percpu address space checks. Signed-off-by: Uros Bizjak Cc: Catalin Marinas Cc: Andrew Morton Acked-by: Catalin Marinas --- v2: Implement as macros to avoid powerpc build failure --- include/linux/err.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/err.h b/include/linux/err.h index b5d9bb2a2349..a4dacd745fcf 100644 --- a/include/linux/err.h +++ b/include/linux/err.h @@ -41,6 +41,9 @@ static inline void * __must_check ERR_PTR(long error) return (void *) error; } +/* Return the pointer in the percpu address space. */ +#define ERR_PTR_PCPU(error) ((void __percpu *)(unsigned long)ERR_PTR(error)) + /** * PTR_ERR - Extract the error code from an error pointer. * @ptr: An error pointer. @@ -51,6 +54,9 @@ static inline long __must_check PTR_ERR(__force const void *ptr) return (long) ptr; } +/* Read an error pointer from the percpu address space. */ +#define PTR_ERR_PCPU(ptr) (PTR_ERR((const void *)(__force const unsigned long)(ptr))) + /** * IS_ERR - Detect an error pointer. * @ptr: The pointer to check. @@ -61,6 +67,9 @@ static inline bool __must_check IS_ERR(__force const void *ptr) return IS_ERR_VALUE((unsigned long)ptr); } +/* Read an error pointer from the percpu address space. */ +#define IS_ERR_PCPU(ptr) (IS_ERR((const void *)(__force const unsigned long)(ptr))) + /** * IS_ERR_OR_NULL - Detect an error pointer or a null pointer. * @ptr: The pointer to check. 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/GXzWIM0NA6tmfsBE4t8OPDxNK5WfbOgpIuTgUCBWR9cpjlp3mFen3mbI1RYtisaE6qIw1gnGRh8n4dlyorjgpyTyMXTmmEiax76TUXbtikE2Lk8DqJVIh0S88vtTxrYNjoc4fUs7MOEKJcfIf0Yi/+4Ce+n5fCtPsVTuRwRTBFVpd6L2k2zvdVmY1bubLqtqNct6ZXZ/Cu0/PER/YZTjUF1E8aTcOuBk7l/qHs9R4LxTPvmzhVolFWZ1JqDHVDsB/XfW4cihIEd7Weq7pN/TyCnLl20S26BRPQjHQ9qOJSHHEi7ZeAUJWxp6/8nU7AcDo2mbV55PD4hdzcHUWggk9Q/42oxAEDFPQ8FsphIWejGwJf18lISCcYuUlxqF/CEypCNXScOnZVtSGgQYBc+Inu8V2jm2KpsHey9Ano/aM+paWAT0C/VioLZrFcvOyMP5NWueDCl2lp8CyfhcMeIGWUGvR+krd3rVXeW9XQCdlLXD3x3xi7lcUDfzPveiq2GE/RnO521MLEiSyzTXTiv3CP/qhIvLwvNV9qzCEuTpR+v74/5JdB8K+g7ssSt5V mFf4XDYq VxFk2bDP9NS5kpyix1vIrmF1GpXNCojTRRacypZoFzVpXADs/d15u1HCpbGmoGqEdjg5alCCMLiSxhIfNuNupIXSU23yitLLKPXoXObBq/VnXFOreKi/wRLgVK05e50iWiQr+qSe3tz6pbr2JsMs9T8xBsxnZvTDGRqlyNGryt6Cnrl7r8YpcdPU3mCCA4zofXYg+JpXhm+cy/r/BYDEJK8KkXchzDeOKZZbQcsjrGc26UWOw4tt24HjSLKp9HMMtQPyA0oaSdwY8tyOkLFA8fCvQh+MN9YxMG/Ivh4tcEGQ1Fv9BhyuGLl6fygVdGfumQ17tIZmX4+gd7Xx8Cfi1J2NJChSZ7SSjbPKiTrpz6VzKqniv+9LgpWT3mP91DgrEZk35uQQ4+Q1UPPurjk3Sm541HPngVUPXcYUZt29gH8mCQoCcY/j+8P3R43PSewwd2ABc0XQdgY8RfckJOLp4i5HZlXrN1GrRbPGMfOgR53EpNoXAt9iBKruW1En0qfFsMIosexKet7Ug5lk= 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: 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);