Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1391524
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] mm: use unsigned long constant for page flags |
| Date | 2016-04-30 01:30 +0200 |
| Message-ID | <rtq1c-6eF-9@gated-at.bofh.it> (permalink) |
| References | <rtpRw-69r-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, 29 Apr 2016 16:15:23 -0700 Yu Zhao <yuzhao@google.com> wrote: > struct page->flags is unsigned long, so when shifting bits we should > use UL suffix to match it. > > Found this problem after I added 64-bit CPU specific page flags and > failed to compile the kernel: > mm/page_alloc.c: In function '__free_one_page': > mm/page_alloc.c:672:2: error: integer overflow in expression [-Werror=overflow] > Fair enough. > --- a/include/linux/page-flags.h > +++ b/include/linux/page-flags.h > @@ -474,7 +474,7 @@ static inline void ClearPageCompound(struct page *page) > } > #endif > > -#define PG_head_mask ((1L << PG_head)) > +#define PG_head_mask ((1UL << PG_head)) We do have the BIT() macro. I don't think it would add a lot of value here; I'd be OK with it either way.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] mm: use unsigned long constant for page flags Yu Zhao <yuzhao@google.com> - 2016-04-30 01:20 +0200 Re: [PATCH] mm: use unsigned long constant for page flags Andrew Morton <akpm@linux-foundation.org> - 2016-04-30 01:30 +0200
csiph-web