Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2368351imm; Mon, 24 Sep 2018 03:12:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY0ZZMwimbbBRaJ/8QNwbrCUgRRwD2CTMv85NJTG28u5SY9zlx5UoHfUMjxYeBAEw1kR8eP X-Received: by 2002:a62:8145:: with SMTP id t66-v6mr4015221pfd.192.1537783967475; Mon, 24 Sep 2018 03:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537783967; cv=none; d=google.com; s=arc-20160816; b=zLunexzdCPxQL69oz9RaA34GvePdMH4QBgCaR8jgHIBlznGw1H16cqSgi03/HTYgNS 5miMt+irUkT8iPj5VSNuAuhEIjkmwwd7Dgy/O1xvY4rHLrCQIELPBooHKHAKC9R8QSw1 Zjl/khjm0Jv9ouyQSiuv3LfSX7pfAyUnUanetylaTn3avh5Tt1QsfqxnBhol7BkuJj7s rpwajHOiHXuCdQA+dTR6rCApgHbrVFp/ZSgy4Jts1TEI9kUWra+7f9+/Swy93FKKDC8q JfbyKLotZmVXA3smomyvlec2/zbueO/cMcNGJ/uoEGjXNej79eRNK7A9n2s2uw7FW0gd L7FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Ig9mBor6Vwwn4DYl4UdniUpV/rwBF8VdzUTE/e7dEs4=; b=RLUR92uYAdEdnSyTHA/mqNQDgxnxmLz4ZaYRPrH8zQ9PbRdoLYS8ZWEuefR4rPN/r5 G8OuPjnWLx847T98vus5U1uYMUAo5Q3U8puDrBawQmgwYjESh/xHAZniotRfxyYn1Ek5 97cdgj6Yj5JuFE2Q0cwpl2xmpewkMAutOst27k/oeXsiozLVGRG3pYO3U/kHhm4Agqil RzFdV79xOCgQoUzVGNbP11nsU4YwiZ0iBPWbAAPrMMkzRFcQgEuajggYnBh3AT6QQz0u 9q+gVtWmEiLTNmj1RY2zMr8x9QmqB/0jk7ZLvQJ8cTujgRyI8qRNbnT7KfG7qFJiq9c0 BF+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=JJRM0KSL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 203-v6si13621796pge.693.2018.09.24.03.12.32; Mon, 24 Sep 2018 03:12:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=JJRM0KSL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728573AbeIXQN1 (ORCPT + 99 others); Mon, 24 Sep 2018 12:13:27 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36328 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728389AbeIXQN0 (ORCPT ); Mon, 24 Sep 2018 12:13:26 -0400 Received: by mail-wm1-f67.google.com with SMTP id y13-v6so4650337wmi.1 for ; Mon, 24 Sep 2018 03:12:06 -0700 (PDT) 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=Ig9mBor6Vwwn4DYl4UdniUpV/rwBF8VdzUTE/e7dEs4=; b=JJRM0KSL00sDd4gsBejDecMytRBu57SOdnHmLSJdvSWRrtQmxoD7GlHievO5p22+XF DIwqPilexuKrnMQxg+x7VKNHaqvrxGOciQVt78pq+IiP/07OKF5DIyOMPySo0wVIbCBk GfuMANULQwzE7RboMFugcqwVjxXaP/J1Fb4sosS8406LgoX7Q7qNxyFCG6bsunDtTDL3 A1TQsZDYpdt0MvfqEavVlMJW4IsQUCvKcdc4lP6i3R+I3WHjN+c7mKVjxSkPlNPYEahT l4IpY393sTVPuYFHvrHY1fAchqjisT8k0qOuQSNAUkVSQgKfk07YMMMaUkaB3MZ4mTx0 pORw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ig9mBor6Vwwn4DYl4UdniUpV/rwBF8VdzUTE/e7dEs4=; b=bPOZ02sdzXV/4EdaukjoASEDHG8IrE61jrjR1DBAaO8UlDBGSkFRzCBSM81NGSIw+R gj8tvVpN549+tOKP/hNyrtGEm3fQxEm5Aw1x3vxmWzVskYWucsCFETzC7qJwFA7dRmac kjyXWBviiixdCmi/m3b9VpGdEzr9z2AYJMUHdEToyvXbWUz4cIzBd64Wruznhm8N6Gtf RBpb+s7bljpDT1JY2R2ty9//EtGZSy4qVvjjeu2LGQY64xV3eOFOAGL3+PX2NnrGMyVc Kh0+kVFoutiCMZiFLwyoIy5Ilz5fFhwqMCpbaYMsx/ZsX5WhHBvsQrXkNtTmMliJ6iFo xgbw== X-Gm-Message-State: ABuFfoi1hHVyPSmV6lpqf5WdsWKpWXdIN4QFwqKNJF2SGsHDPZ4D8jVs SegGHps6V3y1q4ATzOhz4evubg== X-Received: by 2002:a1c:b20b:: with SMTP id b11-v6mr613454wmf.64.1537783925302; Mon, 24 Sep 2018 03:12:05 -0700 (PDT) Received: from brgl-bgdev.baylibre.local (AStLambert-681-1-2-33.w90-86.abo.wanadoo.fr. [90.86.1.33]) by smtp.gmail.com with ESMTPSA id o12-v6sm3291728wrj.58.2018.09.24.03.12.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 03:12:04 -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 , Andy Shevchenko Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Bartosz Golaszewski Subject: [PATCH v3 2/4] mm: move is_kernel_rodata() to asm-generic/sections.h Date: Mon, 24 Sep 2018 12:11:48 +0200 Message-Id: <20180924101150.23349-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180924101150.23349-1-brgl@bgdev.pl> References: <20180924101150.23349-1-brgl@bgdev.pl> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 9e3ebd2ef65f..470f5cd80b64 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 -- 2.18.0