// A variable declared as a 32-bit data type should not be shifted by // PAGE_SHIFT because the result may not fit in sizeof(T) for large // numbers of pages, or high page frame numbers, e.g. both of these // are potentially bogus: // // unsigned long pfn; // unsigned int numpages; // ... // unsigned long pa = pfn << PAGE_SHIFT; // unsigned long size = numpages << PAGE_SHIFT; // // Options: --no-includes --include-headers virtual context virtual report virtual org @inttrunc@ {int, unsigned int, size_t, signed int, long, unsigned long, signed long} i; position p; type tt; tt i1; @@ \(i@p\&i1\) << PAGE_SHIFT @script:python@ p << inttrunc.p; i << inttrunc.i; tt << inttrunc.tt; @@ pae_types = ["unsigned long", "signed long", "long"] print "* file: %s:%s shifting %s '%s' by PAGE_SHIFT is truncated to 32-bits%s" % \ (p[0].file, p[0].line, tt, i, \ " for PAE" if tt in pae_types else "")