Re: [PATCH v2] scsi: scsi_debug: fix one-partition tape setup bounds

From: "Kai Mäkisara (Kolumbus)"

Date: Thu Jun 04 2026 - 12:35:26 EST




> On 4. Jun 2026, at 17.52, Kai Mäkisara (Kolumbus) <kai.makisara@xxxxxxxxxxx> wrote:
>
>
>
>> On 4. Jun 2026, at 16.38, James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> On Wed, 2026-06-03 at 23:55 +0000, Samuel Moelius wrote:
>>> The tape setup path writes partition metadata one element past the
>>> allocated tape_blocks array when a one-partition configuration is
>>> selected.
>>>
>>> That corrupts adjacent state during device initialization before any
>>> command is issued.
>>
>> I still don't get what the actual problem is. For a single partition
>> tape I can't see where scsi_debug would actually do anything with
>> tape_blocks[1]. What is it that you're seeing when using scsi_debug
>> that motivates this?
>>
> The code marks partition 1 as EOD and does not corrupt anything. The tape has partitions
> until either EOD partition is encountered or TAPE_MAX_PARTITIONS is reached. I would
> be very hesitant to remove this initialization.
>
I looked more carefully at the code:-) Each partition ends at EOD block. But I would still not like
to remove this initialization because, even if it is not necessary, it is harmless. There has been a
reason to do the initialization like that at some time. And the code is simpler as it is now.

Thanks,
Kai