On Fri, Feb 03, 2017 at 04:42:27PM +0800, zhouxianrong@xxxxxxxxxx wrote: > +static inline void zram_fill_page_partial(char *ptr, unsigned int size, > + unsigned long value) > +{ > + int i; > + unsigned long *page; > + > + if (likely(value == 0)) { > + memset(ptr, 0, size); > + return; > + } > + > + i = ((unsigned long)ptr) % sizeof(*page); > + if (i) { > + while (i < sizeof(*page)) { > + *ptr++ = (value >> (i * 8)) & 0xff; > + --size; > + ++i; > + } > + } > + > + for (i = size / sizeof(*page); i > 0; --i) { > + page = (unsigned long *)ptr; > + *page = value; > + ptr += sizeof(*page); > + size -= sizeof(*page); > + } > + > + for (i = 0; i < size; ++i) > + *ptr++ = (value >> (i * 8)) & 0xff; > +} You're assuming little-endian here. I think you need to do a cpu_to_le() here, but I don't think we have a cpu_to_leul, only cpu_to_le64/cpu_to_le32. So you may have some work to do ... -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>