Re: [PATCH v2] x86/sgx: use vm_flags_t for vm_prot_bits

"Huang, Kai" <[email protected]>
Newsgroups org.kernel.vger.linux-sgx,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On Thu, 2026-01-22 at 21:36 +0800, Wentong Tian wrote:
> The vm_flags_t type is the dedicated type for virtual memory flags.
> Architecture and driver code should use this type instead of assuming
> vm_flags is an unsigned long, as the underlying type may change in the
> future.
> 
> This follows the cleanup in commit d75fa3c94750 ("mm: update
> architecture and driver code to use vm_flags_t") by converting the
> remaining vm_prot_bits usage in SGX code. Also, update the vm_max_prot_bits
> type in struct sgx_encl_page to vm_flags_t for consistency.
> 
> No functional change intended.
> 
> Signed-off-by: Wentong Tian <[email protected]>
> ---
> v2:
>  - Also convert the type of vm_max_prot_bits in struct sgx_encl_page
>    to vm_flags_t, as suggested.

Hmm I was actually just pointing out, but not suggesting, since I am not
sure (honestly).

Back to technical:

Gcc doc says:

  A structure field declaration with an integer type can specify the 
  number of bits the field should occupy. We call that a bit field.

With vm_flags_t I think "theoretically" it could stop being integer type
someday.  But I guess the advantage is when someone does that that can
trigger build error here (so that we can be aware) which perhaps isn't a
bad thing?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.