From nobody Mon Jun 8 07:22:05 2026 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF26123D2B1 for ; Thu, 4 Jun 2026 23:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780616850; cv=none; b=QXFQMfmUYAyxdjWrjSeurkjFRElg2lADILz8BaXvUPeGnszezYPUVOkLoVGH9f2Bfp3moYGAKfLlFdU+W9IQBQDxjJsO4KU2e7a3GafKjga7bt0ETRXuK3BEPPSqRovWy42ZUIcyOFtdqo2cEadu7dySYFckxvMrtFG2ufQT5ZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780616850; c=relaxed/simple; bh=jj/ikHmykGQz64SAjkwMrbkSbr6d3VssuLkwrKzhwfI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Tya0YIbEvoJWaVXBWoijAZLpGxLrGGberIhEsIQx/v+uZ/AUskNGUaAF+oJXbnQt5sSlMDZzIjH7NOmnidiBpyszTtpLVoKH5zviTFV1uh8QWnWId8ogSuE7g3rLMFQZDjr9hNMZgzgFUOI0NrHbrcA2Efrpv1ijQMae29PRlpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com; spf=pass smtp.mailfrom=trailofbits.com; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b=AD7GyzSG; arc=none smtp.client-ip=209.85.222.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b="AD7GyzSG" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-9159f631656so148180885a.1 for ; Thu, 04 Jun 2026 16:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trailofbits.com; s=google; t=1780616848; x=1781221648; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+ER1e63u4SB1f1fdhBGU/vKtYoHgpqUszESl9YWHkEU=; b=AD7GyzSGy5bfJpTK80aeig08HfmP5AzlTSm1ocmfAGwy39SEoZOK/pSdp2N0TOqScE 4D2vE3PmLjieb4uax+v7fJk3f95ybl7QC4vxeW9tte5Q67PJl3FD2aOMP5kUOc/V0wpP 2/FxvSzfRaZi4w8E4cGgwze84FiPicJ5KTaKadNeG4oajTkG8rnxUlfs8+M0EfPtdnuO bwt9BNbm2J6sIMCJBtI+jV8l9NYEp8ANsbcEq4QduDO7pH64/j+FLQFnjto6OujYvWwt alCmAylILjt/xq3GYrOirxJ+7BxFsgU9J1Q68fSDkerm018XCJaDMFQxOvGjtYfpIxEk FMhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780616848; x=1781221648; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+ER1e63u4SB1f1fdhBGU/vKtYoHgpqUszESl9YWHkEU=; b=pSu72sRNTJVfyxXlLZl6PTqAPbxGQI5qDB1LB8z8EUvuqzIPs9uya1acZQ5qcN9pXx fOB6pZDDrihUxO9PFcymTCVoM3SD70RjPHBFjT1LYs6x1sIL73O4xPltcGKNbzKRz6HG tRphrXTBn+v9nNp0jNhdR6MVM3FT/SOkN1A2flPjtOfZe+cEo9qVJOKpNCXFrNCaLbWm 8wyMgUJykM2qZ+eowJuqGvSOUX4VJsQOKAaoaBHs/akSRDZYRSW//5pgYqKGMqgYtNlz WYNO4sot1dp7y6xgMN1u2cPrJJh9FwwgJDT3CUCChFCd8EP/Y0lzj7k932SXTBX0ELFw Ogsw== X-Forwarded-Encrypted: i=1; AFNElJ9Tq6/rY03OR/ukmx9khsI3aHvvpgyyN8pK/BF08mTVMnEqyn+9mP4GzOhdrQWZBBKyAo358KSIX3vzFOc=@vger.kernel.org X-Gm-Message-State: AOJu0YzZwGl6LXUKXO802Ac74COzrXsPcIWmoCfoJkX7FOWRqNEkS28z oLI8J9p+wUUG5SQW7nGAO2hvOT9UKPlWTIq5neMtjK55hBdRdtocYIqrsxH7SnPeQI8= X-Gm-Gg: Acq92OH5VsNIUvJ8x1RFkbs+g47LC91L6srMhnT+Zj6VXU2HctVvCEjnUGuNeN/G1LE 3zb+8Qf2CgW1zEKumblT5nxJAhhrm7lcYZhgTlIxAON2ail71grvVDfyQiF9n7/igwhgXpWRmnl Wen5sxFGfeKrFjxRmyr1xtZ708yvXqFYlOUJYsoXtBqn80tdq+WLC58GtbrJZ0IgNCQgsHvV8do 3NKb8cI0iP4QziMrWr+L9rTnzjYlJi+v47mD0YhsniGJaF5k5cxeUckq5noOIMm1WYAi577t5r8 0SgI2IbbdeInlqp5PM27zW3G7tWaOKpSAnmY1ylDMa0IuLDP+VF/cUL1p5epMOf7CANt5iCVbfk 0BnI8dF/+eK4GCXc15TYuIluOpgCpIaxAMOZYIj0ot4uXqW+rz6LGtuUHXPPdtK34PLtZu9SPyT VGgbL1yMN2tRN+F7JdR9xFe3wlIHCSokokx64MmeXtuhN7dqGv X-Received: by 2002:a05:620a:4625:b0:913:dcd2:f117 with SMTP id af79cd13be357-915ad2f40aamr30188785a.24.1780616847865; Thu, 04 Jun 2026 16:47:27 -0700 (PDT) Received: from localhost ([161.35.96.86]) by smtp.gmail.com with UTF8SMTPSA id af79cd13be357-9158a37cae4sm721753685a.29.2026.06.04.16.47.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Jun 2026 16:47:27 -0700 (PDT) From: Samuel Moelius To: "James E.J. Bottomley" Cc: Samuel Moelius , "Martin K. Petersen" , linux-scsi@vger.kernel.org (open list:SCSI SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3] scsi: scsi_debug: fix one-partition tape setup bounds Date: Thu, 4 Jun 2026 23:43:56 +0000 Message-ID: <20260604234724.1936118-1-sam.moelius@trailofbits.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The tape setup path uses one tape_block entry as the end-of-data marker after the usable tape blocks. For the one-partition layout, partition 0 uses all TAPE_UNITS data slots and partition 1's marker is written at tape_blocks[0] + TAPE_UNITS. Only TAPE_UNITS entries are allocated, so that marker write is one element past the allocation during device initialization before any command is issued. Allocate one extra tape_block entry for the marker. This keeps the existing partitioning paths unchanged while providing backing storage for the sentinel. Assisted-by: Codex:gpt-5.5-cyber-preview Signed-off-by: Samuel Moelius Reviewed-by: Kai M=C3=A4kisara > --- Changes in v3 - Use TAPE_UNITS + 1 approach Changes in v2 - Fixed handling of part_1_size =3D=3D 0 case drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 1515495fd9ea..38fedfa3cefe 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -6648,7 +6648,7 @@ static int scsi_debug_sdev_configure(struct scsi_devi= ce *sdp, if (sdebug_ptype =3D=3D TYPE_TAPE) { if (!devip->tape_blocks[0]) { devip->tape_blocks[0] =3D - kzalloc_objs(struct tape_block, TAPE_UNITS); + kzalloc_objs(struct tape_block, TAPE_UNITS + 1); if (!devip->tape_blocks[0]) return 1; } --=20 2.43.0