> On Jun 27, 2020, at 9:31 PM, Bart Van Assche <bvanassche@xxxxxxx> wrote: > > On 2020-06-24 01:53, Bodo Stroesser wrote: >> The fix is to use the maximum of remaining ring space and >> sizeof(struct tcmu_cmd_entry) as the length param. >> > > [ ... ] > >> + /* >> + * Flush max. up to end of cmd ring, since current entry might >> + * be a padding that is shorter than sizeof(*entry) >> + */ >> + size_t ring_left = head_to_end(udev->cmdr_last_cleaned, >> + udev->cmdr_size); >> + tcmu_flush_dcache_range(entry, ring_left < sizeof(*entry) ? >> + ring_left : sizeof(*entry)); >> >> if (tcmu_hdr_get_op(entry->hdr.len_op) == TCMU_OP_PAD) { >> UPDATE_HEAD(udev->cmdr_last_cleaned, > > The patch description says "maximum" but the above formula calculates the > minimum of "ring_left" and sizeof(*entry). Did I perhaps misread this patch? Ah yeah, Bodo probably meant to write what they wrote for the comment above about the max up to the end of the ring and not max of space left and entry size.