Avoid potential buffer overrun in atomic_write()