From patchwork Tue Aug 28 09:33:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10578089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6F9617DB for ; Tue, 28 Aug 2018 09:34:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7B3928869 for ; Tue, 28 Aug 2018 09:34:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C0EC28ABE; Tue, 28 Aug 2018 09:34:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A55728869 for ; Tue, 28 Aug 2018 09:34:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 290D16B456C; Tue, 28 Aug 2018 05:34:10 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 127B66B456D; Tue, 28 Aug 2018 05:34:10 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 013F56B456E; Tue, 28 Aug 2018 05:34:09 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 996096B456C for ; Tue, 28 Aug 2018 05:34:09 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id p105-v6so839187wrc.11 for ; Tue, 28 Aug 2018 02:34:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=wc9ZRwnUmb5rXGt9YW/Z3OT0r34lfcDOfLS8ZydfUMY=; b=HuKv3i8MwI5p101tSmBaSKEj8M8fZWx8Dx0VCma3dMTyIQYFYgkvR/B8tLIDTKF+my RoHBTskgQEHnqcfzFClWaHnUpurOUQm7gXrbSTfWteEFP7uSuw93XuJP+vODJ6nWsXgV IK8l5qpZZ3vRsqtfutlltmcuXUs+IIAynkCRGarzUsJvW/q5O5Z7lY/mYyvADSE0P8ti 4GiUSgQeKrR5h9tril7CaqJLlWvObvX4QoFL9POgbGd7KUFTZpRq+derty63gaePxXMO FAGB4UsXvK58XFhcrp5z4rO6CF7wdSjIZHKRtfju/LZhQzk9MSpGe/FZUR/mMaw4r9R1 px9A== X-Gm-Message-State: APzg51CKR1OY2WtqmiIfbpJsv9ZUGLqiED7BBE8SXRUQU6xNeGLYC56N WDRqV6w0AyKHUaGvysdStrYxSmd3sUT3uaQepO5y0bXqlF7Vu6yQ9CUckYL/aP26f47gMrwFVea FsvM6Z9vPD6Q5PuUFA7s0aztHOKZbY+jjaFrzCBS+2PvhYi3so79sXYlYkEIZ0RnX9XYf+liuHb 1nz4mv1D+ifz5zojj2gOn8m3fRfMCqN+/gxJEcJd3AdCdvmoSDHL85nlvlWH5RW1D6wPrnGlLMo aTD85IlYrzk4Aw1SHIe9akJHU3XlQ7Mt1CAIk4wJPEcYAAqnXpXN39EjAb+5TcqRZMPGs8fILdm 0d1yTsUaOgwzilURaFrHarIqxqGcSIiC8vCAgdT2l5dbi+ebrq0I/XPzvOQHtDadWrIIO0M5YwN S X-Received: by 2002:adf:ed04:: with SMTP id a4-v6mr573346wro.262.1535448849157; Tue, 28 Aug 2018 02:34:09 -0700 (PDT) X-Received: by 2002:adf:ed04:: with SMTP id a4-v6mr573307wro.262.1535448848350; Tue, 28 Aug 2018 02:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535448848; cv=none; d=google.com; s=arc-20160816; b=WfFCVjDlMVp+WQdTJJyiG7hg7hlq1qaSb7iEwb6vJ46z/frPcDYO/4xZpICycVMaij dFe6QhOsu0CcLh6410O7MCgcFkq/VQiZs8AA57YVvLtmWggE0OkELuCwaAryPK9HcYNS cGJyXAYhhBcyE12lS64/MgOU+PxF7G8MpAW/ms5XKShjqLJpfNg8FN83aUsMSqTcIWk2 zVrzXfPdjswir+ohj2wwg6QByhyRSwboIYOZz6oON9TBz+EVICh1rgc+4OBh/OlpLCsS MEfoaxGqQEGKuL3OJpZajD+34ih/xd1LQ3+RaS0QotAtHriLxhwkOq/R7rAIjj3Nm8X6 jbfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=wc9ZRwnUmb5rXGt9YW/Z3OT0r34lfcDOfLS8ZydfUMY=; b=UBfblBqq70NmlgqjwiNuTuZfOTaiOqYIuPZ1ibWgSO+ELCpy3+k2Wmjdb3hZnxbSJ2 bJlJAafVJTjvyRpk0mOepzH5UuPfxFZzFJCq85palrRthIFyoxrEaCRL787zHkEwkDWs xaRDRO9dZowTTtIVIL8SYFl9EfMpjP5UVecUZzoYJaUKY8YDOL56kUfE5l240yey7t5x mUx/aAyyTbjUQWnS67RD2AXXZwMWevUDGxAmVf/H3lzeKa2KO5FU8vB3Kp5Bp7kXTg7G hPtZNuyAjSHOYhQbMTd30UTbaEDUG+QWt75PEy36QTjuS4v7n0WzhPpT2DhVNG2K0RQv nzyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=MME6CIbn; spf=neutral (google.com: 209.85.220.65 is neither permitted nor denied by best guess record for domain of brgl@bgdev.pl) smtp.mailfrom=brgl@bgdev.pl Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id h18-v6sor237298wrt.57.2018.08.28.02.34.08 for (Google Transport Security); Tue, 28 Aug 2018 02:34:08 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.65 is neither permitted nor denied by best guess record for domain of brgl@bgdev.pl) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=MME6CIbn; spf=neutral (google.com: 209.85.220.65 is neither permitted nor denied by best guess record for domain of brgl@bgdev.pl) smtp.mailfrom=brgl@bgdev.pl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wc9ZRwnUmb5rXGt9YW/Z3OT0r34lfcDOfLS8ZydfUMY=; b=MME6CIbn6ztirIfcMA3UHlZmo1USCfNk6oYrqrfS2kcBjaNSlBGu0Xt3IwJZJhOBa4 zRIVln4bKyOO9n7wPDACSj85rW1EivMdt4i794d5x79jKqT8lqvxRhLlvILxHCDAOGbD seIfVj33o/l6LK9f+eDElZyrX6Z+uhE83lFQTN98edjMRs5CpMwoYxwH6rks8zSFzkdp q+1pL9rlXPsXqmQHC/m1wvlrWWZCscU6mCX/Ru8R5B1aMJxPj1b2QDe4SUWDRE0ncTg7 r1hGif/HO0HXvVRQzxgJOlmQeSasPabVm9nYQ529cNM+/kyaUmuiTT+l8ZFQ9UGnEErd C9yg== X-Google-Smtp-Source: ANB0VdYZg1uzJ+5+eFWd2GzaecxTUS0AzdL/Zfb2QSzLa7FMQgAFFXWWu6LyRuwDUGxRbdwq6jNxzw== X-Received: by 2002:adf:f8ca:: with SMTP id f10-v6mr568901wrq.237.1535448848093; Tue, 28 Aug 2018 02:34:08 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id l18-v6sm952276wru.75.2018.08.28.02.34.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 02:34:07 -0700 (PDT) From: Bartosz Golaszewski To: Michael Turquette , Stephen Boyd , Greg Kroah-Hartman , "Rafael J . Wysocki" , Arend van Spriel , Ulf Hansson , Bjorn Helgaas , Vivek Gautam , Robin Murphy , Joe Perches , Heikki Krogerus , Andrew Morton , Mike Rapoport , Michal Hocko , Al Viro , Jonathan Corbet , Roman Gushchin , Huang Ying , Kees Cook , Bjorn Andersson , Arnd Bergmann Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Bartosz Golaszewski Subject: [PATCH v2 2/4] mm: move is_kernel_rodata() to asm-generic/sections.h Date: Tue, 28 Aug 2018 11:33:30 +0200 Message-Id: <20180828093332.20674-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180828093332.20674-1-brgl@bgdev.pl> References: <20180828093332.20674-1-brgl@bgdev.pl> 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: X-Virus-Scanned: ClamAV using ClamSMTP Export this routine so that we can use it later in devm_kstrdup_const() and devm_kfree_const(). Signed-off-by: Bartosz Golaszewski Reviewed-by: Bjorn Andersson --- include/asm-generic/sections.h | 14 ++++++++++++++ mm/util.c | 7 ------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 849cd8eb5ca0..d79abca81a52 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -141,4 +141,18 @@ static inline bool init_section_intersects(void *virt, size_t size) return memory_intersects(__init_begin, __init_end, virt, size); } +/** + * is_kernel_rodata - checks if the pointer address is located in the + * .rodata section + * + * @addr: address to check + * + * Returns: true if the address is located in .rodata, false otherwise. + */ +static inline bool is_kernel_rodata(unsigned long addr) +{ + return addr >= (unsigned long)__start_rodata && + addr < (unsigned long)__end_rodata; +} + #endif /* _ASM_GENERIC_SECTIONS_H_ */ diff --git a/mm/util.c b/mm/util.c index d2890a407332..41e9892a50ce 100644 --- a/mm/util.c +++ b/mm/util.c @@ -15,17 +15,10 @@ #include #include -#include #include #include "internal.h" -static inline int is_kernel_rodata(unsigned long addr) -{ - return addr >= (unsigned long)__start_rodata && - addr < (unsigned long)__end_rodata; -} - /** * kfree_const - conditionally free memory * @x: pointer to the memory