Skip to content

Commit f0edef8

Browse files
glikelybzolnier
authored andcommitted
xsysace: Fix dereferencing of cf_id after hd_driveid removal
Commit 4aaf2fe (xsysace: make it 'struct hd_driveid'-free) converted the cf_id member of 'struct ace_device' from a 'struct hd_driveid' to a u16 array. However, references to the base of the structure were still using the '&' operator. When the address was used with the ata_id_u32() macro, the compiler used the size of the entire array instead of sizeof(u16) to calculate the offset from the base address. This patch removes the use of the '&' operator from all references of cf_id to fix the bug and remove future confusion. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1 parent fb4252e commit f0edef8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/block/xsysace.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
563563
case ACE_FSM_STATE_IDENTIFY_PREPARE:
564564
/* Send identify command */
565565
ace->fsm_task = ACE_TASK_IDENTIFY;
566-
ace->data_ptr = &ace->cf_id;
566+
ace->data_ptr = ace->cf_id;
567567
ace->data_count = ACE_BUF_PER_SECTOR;
568568
ace_out(ace, ACE_SECCNTCMD, ACE_SECCNTCMD_IDENTIFY);
569569

@@ -608,8 +608,8 @@ static void ace_fsm_dostate(struct ace_device *ace)
608608
break;
609609

610610
case ACE_FSM_STATE_IDENTIFY_COMPLETE:
611-
ace_fix_driveid(&ace->cf_id[0]);
612-
ace_dump_mem(&ace->cf_id, 512); /* Debug: Dump out disk ID */
611+
ace_fix_driveid(ace->cf_id);
612+
ace_dump_mem(ace->cf_id, 512); /* Debug: Dump out disk ID */
613613

614614
if (ace->data_result) {
615615
/* Error occured, disable the disk */
@@ -622,9 +622,9 @@ static void ace_fsm_dostate(struct ace_device *ace)
622622

623623
/* Record disk parameters */
624624
set_capacity(ace->gd,
625-
ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
625+
ata_id_u32(ace->cf_id, ATA_ID_LBA_CAPACITY));
626626
dev_info(ace->dev, "capacity: %i sectors\n",
627-
ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
627+
ata_id_u32(ace->cf_id, ATA_ID_LBA_CAPACITY));
628628
}
629629

630630
/* We're done, drop to IDLE state and notify waiters */
@@ -923,7 +923,7 @@ static int ace_release(struct gendisk *disk, fmode_t mode)
923923
static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
924924
{
925925
struct ace_device *ace = bdev->bd_disk->private_data;
926-
u16 *cf_id = &ace->cf_id[0];
926+
u16 *cf_id = ace->cf_id;
927927

928928
dev_dbg(ace->dev, "ace_getgeo()\n");
929929

0 commit comments

Comments
 (0)