Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1263091 > unrolled thread

Re: [PATCH 1/2] asm/sections: Add helpers to check for section data

Started byAndrew Morton <akpm@linux-foundation.org>
First post2015-11-05 12:00 +0100
Last post2015-11-05 12:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2] asm/sections: Add helpers to check for section data Andrew Morton <akpm@linux-foundation.org> - 2015-11-05 12:00 +0100

#1263091 — Re: [PATCH 1/2] asm/sections: Add helpers to check for section data

FromAndrew Morton <akpm@linux-foundation.org>
Date2015-11-05 12:00 +0100
SubjectRe: [PATCH 1/2] asm/sections: Add helpers to check for section data
Message-ID<qrqqR-5un-9@gated-at.bofh.it>
On Thu, 29 Oct 2015 09:26:06 +0100 Thierry Reding <thierry.reding@gmail.com> wrote:

> From: Thierry Reding <treding@nvidia.com>
> 
> Add a helper to check if an object (given an address and a size) is part
> of a section (given beginning and end addresses). For convenience, also
> provide a helper that performs this check for __init data using the
> __init_begin and __init_end limits.
> 
> ...
>
> --- a/include/asm-generic/sections.h
> +++ b/include/asm-generic/sections.h
> @@ -63,4 +63,15 @@ static inline int arch_is_kernel_data(unsigned long addr)
>  }
>  #endif
>  
> +static inline bool section_contains(void *virt, size_t size, void *begin,
> +				    void *end)
> +{
> +	return virt >= begin && virt + size <= end;
> +}

This is ambiguous: does it return true if the object is wholly within
the region, or if it is only partially within the region.  A code
comment will help.  Something like

/*
 * Return true if the region described by [virt, virt+size) is wholly contained
 * within the region described by [begin, end).
 */


Which makes me wonder whether this function should in fact do
"partially within".  Shrug, doesn't matter much I guess.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web