Skip to content

Commit ba06677

Browse files
committed
ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
JIRA: https://issues.redhat.com/browse/RHEL-72617 Refactor scsi_6_lba_len() with use of get_unaligned_be24() to make it consistent with other similar helper implementations. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20241016131845.898632-1-andriy.shevchenko@linux.intel.com Signed-off-by: Niklas Cassel <cassel@kernel.org> (cherry picked from commit 08b64ee) Signed-off-by: Tomas Henzl <thenzl@redhat.com>
1 parent 9294c6d commit ba06677

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

drivers/ata/libata-scsi.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,17 +1334,8 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
13341334
*/
13351335
static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
13361336
{
1337-
u64 lba = 0;
1338-
u32 len;
1339-
1340-
lba |= ((u64)(cdb[1] & 0x1f)) << 16;
1341-
lba |= ((u64)cdb[2]) << 8;
1342-
lba |= ((u64)cdb[3]);
1343-
1344-
len = cdb[4];
1345-
1346-
*plba = lba;
1347-
*plen = len;
1337+
*plba = get_unaligned_be24(&cdb[1]) & 0x1fffff;
1338+
*plen = cdb[4];
13481339
}
13491340

13501341
/**

0 commit comments

Comments
 (0)