From: Bart Van Assche Date: Sun, 28 Jun 2020 02:31:11 +0000 Subject: Re: [PATCH] scsi: target: tcmu: Fix crash on ARM during cmd completion Message-Id: <93e7f9ef-566e-6949-b2c7-2e822ee49f39@acm.org> List-Id: References: <20200624085320.31117-1-bstroesser@ts.fujitsu.com> In-Reply-To: <20200624085320.31117-1-bstroesser@ts.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Bodo Stroesser , "Martin K. Petersen" , Mike Christie , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: JiangYu , Daniel Meyerholt , Henry Willard 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? Thanks, Bart.