From patchwork Tue Aug 13 17:25:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13762376 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 EFB4EC52D7B for ; Tue, 13 Aug 2024 17:25:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 685F56B0089; Tue, 13 Aug 2024 13:25:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 60CA96B0095; Tue, 13 Aug 2024 13:25:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4860E6B0098; Tue, 13 Aug 2024 13:25:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2455A6B0089 for ; Tue, 13 Aug 2024 13:25:56 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C8276A0911 for ; Tue, 13 Aug 2024 17:25:55 +0000 (UTC) X-FDA: 82447899870.12.CA765AC Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by imf04.hostedemail.com (Postfix) with ESMTP id E275140003 for ; Tue, 13 Aug 2024 17:25:53 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=K6d5xkJ1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.174 as permitted sender) smtp.mailfrom=ubizjak@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723569896; a=rsa-sha256; cv=none; b=AUtznKmRg/TxiM2x+UOn6tf6S8PVxdpnxFvGANg2wehS1kiID7pK/agQqfw7uxGm8rPGzn dOwQCfIIwcVibPQV9YVP2Qjx56zuIfllOgyEU9ZrFwTi7h5m6XSEd077f4DPYvzC7e35iS FhFgJfLKwM4Gtcdy57Gvhd3pVgyUmu8= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=K6d5xkJ1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.174 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=1723569896; 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=bckSAEjpJ5PpYoR7hQwJ/XriJMBaeLy4LvLcHeVeksk=; b=rxBNUWiZmQpLJYzhYgQHEnSDfH94RTGtCySaD6eQ5Kua2/y32WaXLofak67N9ELkGtabwL VOOZ2TIePanX3NiR5PqxnvA94pCl9rrGS+tAgu497nzUqmSu0k7vdOoYpwpmkVBuOaONbn xbJtu5z9Pdy45Y3eGzbONNs/3JmdUZU= Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2f189a2a841so55561611fa.3 for ; Tue, 13 Aug 2024 10:25:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723569952; x=1724174752; 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=bckSAEjpJ5PpYoR7hQwJ/XriJMBaeLy4LvLcHeVeksk=; b=K6d5xkJ1ddqqLGH+lrijLeBxICSQ61ktPjzQLw+iaj0482ovTK7DREHq+xM1s9w8jO 9NT0seOyLvPtMwS/kgTp7UqPlxerI3x3H1lSQcehkj9yBLi7BsYH9iB0WTGRbGsBgA6i WGMzzXSnTwPouDFN9dcZ79hv23n5Vd0ddNCMAObTyCOTGoVUCu72Xdpvnx6/E1eDEgiV DU1lHK5vLpzWrcCMJuQFoOc//pirkGw7LOtuUfm2p9kpNI8g38gV1V11SkM+1Qe2LrI+ zucnRoqitCnnwTt7LOWL3wc36xx/BGWdCAn8fVfxs0wZAqhZfC4VjO+Wh5TGsY81aYjD lRzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723569952; x=1724174752; 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=bckSAEjpJ5PpYoR7hQwJ/XriJMBaeLy4LvLcHeVeksk=; b=kNm8mDaN6kqmOK6dteyrtuDoTlG0c+VsESCpSMd/l1qTawrCQv2erjyhWmJqR3FmvD arUxJ7AWaHFKsA+k2qpdgfJ79suXR3DR7EKhBzrAPNqewmZzjVdXY/FANhlg2F0/3RWY w9yN2Uw36rLatDn+CpS7Hqnp0xCLAIO1lE1Dii8Cyo8Cq68ruFuohyQWl1A7UJ9o05ym YBCknTN4VgfwnjL3WXHZW/99xxvhr/EyGrknFeFUh5aPW1197mZyQ94NhRLXhC1C8ooU DwdjDx/evHfKSXUGG8R9VQc0Ze9EpYR7IwJjSgdcIBR+IC2QYsegI9ahI/MK9On0t2M5 WzzQ== X-Gm-Message-State: AOJu0Yypm2jP7pAbPLARpjDAJ/H/JvDloUgULx6QQPramL1v4O9WZMCE 7F2sEruXd2p3DtfzhlQ5KnRv2Cw+xpRggf8isxL1Rcp74jcDazkO4VTKcCRY X-Google-Smtp-Source: AGHT+IEtrrEbrFUqyvWsVDYn/i0zD/QmSZriq6+kJDYHGaNkWu/OFzS6zY1GHBxy1gwb8T33T63Vgw== X-Received: by 2002:a05:651c:b10:b0:2f1:a7f8:810c with SMTP id 38308e7fff4ca-2f3aa2fcd35mr577901fa.33.1723569951313; Tue, 13 Aug 2024 10:25:51 -0700 (PDT) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd187f33cfsm3048343a12.5.2024.08.13.10.25.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 10:25:50 -0700 (PDT) From: Uros Bizjak To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Catalin Marinas , Andrew Morton Subject: [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions Date: Tue, 13 Aug 2024 19:25:10 +0200 Message-ID: <20240813172543.38411-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E275140003 X-Stat-Signature: 6rk6xiteiwcyjtfyowhx3r8nbk3ffmtw X-Rspam-User: X-HE-Tag: 1723569953-625390 X-HE-Meta: U2FsdGVkX19LVFSsWulWGp+atOwSK0ceys+u+l6+ehJedLP0j+gKN7fRXMIk0q88zqq8xZrGXZH/Nj8SxDYponlK1WfPY3cOVryq5lwyRVLx6WzkJZl7jsSsoopRfFcNu33CsrSyazXa/cPBpemlmFKxxjPVbyPeqaAJdwQ5igLr7RiUANGyphP8N61lp5yar0lb5WADOxIWmK/75u49l4UwjUazgyKdCakq+54JLOevTlgQ/1Dxl1NVXP5Kkj6X0nosmpHNzDgZVpaLzQTM+kVu/wSm7TMfjojCnQ/5sBiXSBX69tjYFVZ+NUnMhOK71PsTJ3faHlfMuPpxNJzpdtychrnJdpvV2uz/rIoipM9ZN+QaQqzUcicQ+WpxdZUiLyd3FLiTTQB6mD2EuFMPT1hr/KliGXjvrtkeYWOgKzQmtaTO3yIsoHu15SeN0/FckJfXVOLs4B8xVIJ+uIwCjqN7pE4vPxuKKkcXkboYHVkAV4CMUfg4C30JEl0WdrXaeyKSb847E4u9fclF0AiP82sj+eaGzkv52Y2jI6J+p3VcjkYASeprWaWpx2hUHS31rgZIPSzRipBmthOwJjsxJE9PaVGEduh6gzBF6jVxyh3IMDUk4iqM70n1MaoLON0h/Lht2GbAzl1G/ULHiPLavh2/gOqOtUL6DmIFZ7x2FRHnLXW6AEZSyV5Tb4wNrER5Txr2mJArfV2CtQdwjrNqkIROrQ+Hrs/eeFf2R6MCkaPrQJtVcq2n9eI/SJZuo9BZtLF3Ty1ZD7NznlhWCK/xEzgS28ZTeDOfHBrHENJ3eVKRn6bytZWywW8U3hQqnTcdbwCsuOQYx2cn6KiqA/J6091j2l3ig5FSSYOyXbM07OEBn5YvCyhIGwYD3711JkjadAYeFiaMsxp70nt3VxnwBTgtzmtDGaqtvBpJC1T0xedHNTBW+Q248ojQkFd7cVOegTnCM55pSZpL+5CeM4C AHuB28wL EaXfA8FvzdiuiQuPC+7KIKOuRESpe8fLhT+rvMqZW1sbFz/Yj+QDf3Uy07vFhfET8TMQQxmxxkHosWS4jsne5vMJzTD5tuEnbveAH8UlMiY9okquFQuI8hzvy74XoqisZSncS8RWlVNW4KWrw7hWiBX7z+PIII1iLjfbTm55i57h8V+/nNz3fELf8KaYmiOhjf8L+0geh7u2ixR9fADI+pcaIQJ6Vp+l/fXncL+RFL0krAO4J0nnaXkhdRs/HWMPzPcjQmpqYolzoS/fegjdyPa4k0qzMJ6zgEBpHukoU03Tpodj3ybnRzhfS8ZTOUupejY7S/tMRLNMC+F31+eMgNg3vTncOG7Wk1Fwl/zCKC66hjWI0BryjEDbKALhdjNh6rpdtQZQQw42dWeP5b6uiP1vjOEqVk9ixADbEz9dqEsd6o8r5Rky8CykP87m7pnH5pXf0ry97iyxobrJfY9B46gI38/HY72O5p8DOzGJUq3LD/6tysY/nUCsOMgopi/kqtKlVX9WE/KjRnUs= 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() functions that operate on pointers in the percpu address space. These functions 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 --- include/linux/err.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/include/linux/err.h b/include/linux/err.h index b5d9bb2a2349..997fd6fe1d0c 100644 --- a/include/linux/err.h +++ b/include/linux/err.h @@ -6,6 +6,7 @@ #include #include +#include /* * Kernel pointers have redundant information, so we can use a @@ -41,6 +42,22 @@ static inline void * __must_check ERR_PTR(long error) return (void *) error; } +/** + * ERR_PTR_PCPU - Create an error pointer in the percpu address space. + * @error: A negative error code. + * + * Encodes @error into a pointer value in the percpu address space. + * Users should consider the result opaque and not assume anything + * about how the error is encoded. + * + * Return: A pointer in the percpu address space with @error encoded + * within its value. + */ +static inline void __percpu * __must_check ERR_PTR_PCPU(long error) +{ + return (void __percpu *) error; +} + /** * PTR_ERR - Extract the error code from an error pointer. * @ptr: An error pointer. @@ -51,6 +68,17 @@ static inline long __must_check PTR_ERR(__force const void *ptr) return (long) ptr; } +/** + * PTR_ERR_PCPU - Extract the error code from an error pointer in the + * percpu address space. + * @ptr: An error pointer in the percpu address space. + * Return: The error code within @ptr. + */ +static inline long __must_check PTR_ERR_PCPU(const void __percpu *ptr) +{ + return (__force long) ptr; +} + /** * IS_ERR - Detect an error pointer. * @ptr: The pointer to check. @@ -61,6 +89,16 @@ static inline bool __must_check IS_ERR(__force const void *ptr) return IS_ERR_VALUE((unsigned long)ptr); } +/** + * IS_ERR_PCPU - Detect an error pointer in the percpu address space. + * @ptr: The pointer in the percpu address space to check. + * Return: true if @ptr is an error pointer, false otherwise. + */ +static inline bool __must_check IS_ERR_PCPU(const void __percpu *ptr) +{ + return IS_ERR_VALUE((__force unsigned long)ptr); +} + /** * IS_ERR_OR_NULL - Detect an error pointer or a null pointer. * @ptr: The pointer to check. From patchwork Tue Aug 13 17:25:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13762377 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 66C31C52D7C for ; Tue, 13 Aug 2024 17:26:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E73306B009A; Tue, 13 Aug 2024 13:26:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DFBE16B009E; Tue, 13 Aug 2024 13:26:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9CD46B009F; Tue, 13 Aug 2024 13:26:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A552F6B009A for ; Tue, 13 Aug 2024 13:26:02 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4AA60C0730 for ; Tue, 13 Aug 2024 17:26:02 +0000 (UTC) X-FDA: 82447900164.25.C78216B Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by imf18.hostedemail.com (Postfix) with ESMTP id 607BC1C0008 for ; Tue, 13 Aug 2024 17:26:00 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aI9bnLjk; spf=pass (imf18.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.54 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=1723569925; 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=1p2+DJjM8kktLYbaZQUV2oLKqBVFh91ZfCo85g9Bjba7K1F+IUwI5XNs4vRN2fpuKC4O2w bDcZ8sqRHnj0DWc3QR/zOpIsOr80wGkTtAi8PN0C2973lWlbpt2WaDhQ5hwjfbzYNXenTE KM3r+gMCmXfY8tfMMy7OW6/aZJqzzYk= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aI9bnLjk; spf=pass (imf18.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.54 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723569925; a=rsa-sha256; cv=none; b=TdsACrePNY/VqdICMm8XoON8+EhPY88QbgPHJNG8klFVvWVKLAMWpQrsH/4IS/sUQM7h/C vngGr/IYxoVsnfgg8WRaAtixmYdpU6rUeQLyAzTKe8yWeAjmG3byOf1JcqBViJTfNIiS6N LgcH4ZqQer38oMEclxqmtZ+BMN4SnP0= Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5b8c2a6135eso151910a12.0 for ; Tue, 13 Aug 2024 10:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723569958; x=1724174758; 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=aI9bnLjkMB2tyGY31vGVbW2eH2nrN2tnVGMzzJdUIIWOosGWnmtc9U7l37buS9Pj0m dpVB3XsghYkSkAOU2xGHg8hXwRZbhaQGZuF1kQuxswJ8+1KPUre5Upem+T1ya17dt2P7 W7ABiRTrKQV9FDpiLevM7zIxiY6gQN0YDJiaZ/ikUk6va8rz2D9i7cRDCkFpD9mLAcHn lG3c7bRGmtDT+qHAgXuCYiU2JrVIIRh8HKKD2obbRg1L6ttDsHdF1uzAhBV6w9PvqLgR XG2fjidysYzA7yR1gszssWlV7d5Vy2/o3YPbw91B7kCRI/mpONdQfypIrbgbqVt9AFIA f2rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723569958; x=1724174758; 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=xRJUhDIIPNORGSGgQphL+eQ2BDdfgeNM/eT6u3sG8tubzYN4fRJU83yK9b4VqX/ccC 4eXkUFeVhXucVPtXrSTs8Fh9I9ABA2CPLJNpCvm6KuFtaOOtCq41w8LQVUANGrrTvhgU T73Krfb2G49uV411lOWG8ba3ghQ0gVrkaI1fjzCLTSgLiBJIA3KHwLG82+DGlzzK28i3 fWWv8tZCrhzIzsyQZ/TYHKlmSz01ZC0wc0TdZCi/WJoBM7y6DLcWIVI5ipDTcRLWpqIw 47YKwF2Ihri8Snd8RazunMNq0pBZSyEcUy/BxB+er2vl0MYECtNgc+SHezz3i1lph685 F7pQ== X-Gm-Message-State: AOJu0Yz7eJmC+K1Jnv8xfYlNoDF+RW71n+s1pOU5pYNdGxBZR9nHeJox DGMTBuTvBSi1vv90X7VQRs/Yk0g8pZLWqGPJMpE9MPzw4pDfaFnQfm0U43aC X-Google-Smtp-Source: AGHT+IE4QVfh8ydmK+TpVVe6ygWjOUjOSzuDmszscqXIoFmJ1plu1mVf8Z/I++P76Wku5ywDOfQJfA== X-Received: by 2002:a05:6402:2497:b0:5af:b1d8:f3d5 with SMTP id 4fb4d7f45d1cf-5bea1696b2fmr315160a12.12.1723569957956; Tue, 13 Aug 2024 10:25:57 -0700 (PDT) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd187f33cfsm3048343a12.5.2024.08.13.10.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 10:25:57 -0700 (PDT) From: Uros Bizjak To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Catalin Marinas , Andrew Morton Subject: [PATCH 2/2] mm/kmemleak: Use IS_ERR_PCPU() for pointer in the percpu address space Date: Tue, 13 Aug 2024 19:25:11 +0200 Message-ID: <20240813172543.38411-2-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240813172543.38411-1-ubizjak@gmail.com> References: <20240813172543.38411-1-ubizjak@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 607BC1C0008 X-Stat-Signature: bk7qrym3cnaruto7kc6suy3hmycq68u1 X-HE-Tag: 1723569960-857697 X-HE-Meta: U2FsdGVkX190ULRX+uAiJ1ZuHv3tHAGFbxN+DsMOjh7z0pvStYKDRlLT8+ir4n/pUIQ2PhCMNf6XApYJA3+tjzE3OVUMzVtk2y/R/xK+t/pulFAp8nz1vqyrUXda63j5K7pDhHlihrjw/bu2cFSfen2jbIx0Tk2QiFJP9t4vPdV4DYb42KJN2n52zOG35s30SSbXkR1njPpjlz74GnhOER12IG+1Is0V359nqzPpo0HZyei4ASE1gt0QdwPcVQTT7iXAzej2zz+XF1Tu5+aYbZ/MO3oyOXPvmfI/+rhiMP9b8+op8yVFOMRiW7PTyBS8sLpmz6wOrjcxJUkgSxweWJ8fb65IhRabv8i54duLCUAmVbZko6nzdCdT08Bee1Sha/O8F4eltdwDAGRWMXKYLuPDyrKK9O6ubDKb/woOhocSA6gu0C9WOegOQ3X/Dj9xpJqKpK+y1vJbVLU44dQwGvcVQSn2axGMhuAifYMIEdCqVZef0GK8VRBWM/d2V3/2VG0HjoVTpcRXQlRZ9AsZOZRvL9/xrnwk6IX+4sSjd+A78nLdM0zZOq7xP+wEclNxoeflIfEUXZ5HEHprn7D96sKO+lJnM2KYuoZaTToBNRuG2GdwTwtvADv48RmyBMjkAkjfSR5tyzN9Ug0flEb/1ZkWilGv/goN9RFb4kSbc6r7LWPVRYnBGckjN5pK44n61/yltdRV9g3b0T9M/S8Zp4i+3l0A2/osM7Hhi+tZu5IQSkiuMAFmuNN5qTf9r4/LR29lwBuXgtzVrHuC/LVH9PtIKIDA0N1Jj8KI1q2tYky1JW1DS642YLbFIYq18KVPVsXSlyR1Z+VrL/3ImB620c3KiWRliACDgqu9J0vbS8/4nRMyGy65GkTlUlusRl5NlxzC5GRB0Bqka8lxo607OFeHUUYptXMo6zKgvFkot+GCcUMOG3Hxs0SIG6SUtoKy5xvxhWEpKJAfiXMk4pO edWmM2vS WTW/E2gdwpML0vIs1yP5yQKgf7kBnrVXT+1eMIYUjiaTbMIQLMmZOW3gyToWQzK5DBLnmsQEAPhirbgdtow30wmkL9NsLNlsqPmHUei+K3pMWaHqj9VjXQNR92wgl9l/4U8XrupZfhi1/T/kdT1eAzAW2Tfa2Op/qwZ7RlduCHHOivvgX3gFQIKAjQvKNAxOESfmwNKD9q6WMozXR4IdMJiZnTOeMacJf7KujPw+QY5WKrBZRZvszWd3afe+6FGG1GW9N6VUe35sGmelbNPSCfiMWmBvYRpESwbHU5zUk7mUv1qAa9AzRCn2+A7pOSCO7gXnacnKuJnLM8gDaUqgUuD/R6yKF7eBXrkxrXD7IMptiRj+NSarG7PntoWicQf7aQ3weJRHU9CMEYDWbMoU1MPMaYltqS49a9IX5qxpzDJM22u1B4cNvI4SgnQiCPlRcgdMr/UJte5UqQyWUWRAOO7O/KcVRyI5eG1sL9PksqQPETKZkjDHab9sDxGHKCZoYxz7BF+NBH7rtqEc= 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);