scsi: atp870u: 64 bit bug in atp885_init()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 14 Feb 2018 12:02:31 +0000 (15:02 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 2 Mar 2018 02:10:36 +0000 (21:10 -0500)
On 64 bit CPUs there is a memory corruption bug on probe().  It should
be a u32 pointer instead of an unsigned long pointer or we write past
the end of the setupdata[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/atp870u.c

index 8b52a9dbb9cf5a5fd18dd572f9459db57783b074..b46997cf77e2ac0df2f6df619ed27fae4faaf8d9 100644 (file)
@@ -1413,11 +1413,11 @@ static void atp885_init(struct Scsi_Host *shpnt)
                        atpdev->global_map[m] = 0;
                        for (k = 0; k < 4; k++) {
                                atp_writew_base(atpdev, 0x3c, n++);
-                               ((unsigned long *)&setupdata[m][0])[k] = atp_readl_base(atpdev, 0x38);
+                               ((u32 *)&setupdata[m][0])[k] = atp_readl_base(atpdev, 0x38);
                        }
                        for (k = 0; k < 4; k++) {
                                atp_writew_base(atpdev, 0x3c, n++);
-                               ((unsigned long *)&atpdev->sp[m][0])[k] = atp_readl_base(atpdev, 0x38);
+                               ((u32 *)&atpdev->sp[m][0])[k] = atp_readl_base(atpdev, 0x38);
                        }
                        n += 8;
                }