mm: add end_buffer_read helper function