Skip to content

Commit 5bb2d61

Browse files
kmakisaramartinkpetersen
authored andcommitted
scsi: st: Don't modify unknown block number in MTIOCGET
Struct mtget field mt_blkno -1 means it is unknown. Don't add anything to it. Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> Link: https://bugzilla.kernel.org/show_bug.cgi?id=219419#c14 Link: https://lore.kernel.org/r/20241106095723.63254-2-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 9852d85 commit 5bb2d61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/st.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3756,7 +3756,7 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)
37563756
((STp->density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK);
37573757
mt_status.mt_blkno = STps->drv_block;
37583758
mt_status.mt_fileno = STps->drv_file;
3759-
if (STp->block_size != 0) {
3759+
if (STp->block_size != 0 && mt_status.mt_blkno >= 0) {
37603760
if (STps->rw == ST_WRITING)
37613761
mt_status.mt_blkno +=
37623762
(STp->buffer)->buffer_bytes / STp->block_size;

0 commit comments

Comments
 (0)