[PATCH 05/07] sata_mv: mv_fill_sg fixes v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Grant Grundler wrote:
On Fri, Jan 30, 2009 at 3:50 PM, Mark Lord <liml@xxxxxx> wrote:
Fix mv_fill_sg() to zero out the reserved word (required for ATAPI),
and to include a memory barrier.  This may also help with problems
reported by Jens on the PPC platform.

Signed-off-by: Mark Lord <mlord@xxxxxxxxx>

--- old/drivers/ata/sata_mv.c   2009-01-30 18:31:03.000000000 -0500
+++ linux/drivers/ata/sata_mv.c 2009-01-30 18:32:08.000000000 -0500
@@ -1364,12 +1364,13 @@
                       u32 offset = addr & 0xffff;
                       u32 len = sg_len;

-                       if ((offset + sg_len > 0x10000))
+                       if ((offset + len > 0x10000))

Why the double parens?
..

No reason, no harm -- they were there already.

But if we're being pedantic, here it is again without them:

(REPOST, without the redundant parenthesis)

Fix mv_fill_sg() to zero out the reserved word (required for ATAPI),
and to include a memory barrier.  This may also help with problems
reported by Jens on the PPC platform.

Signed-off-by: Mark Lord <mlord@xxxxxxxxx>

--- old/drivers/ata/sata_mv.c	2009-01-30 18:31:03.000000000 -0500
+++ linux/drivers/ata/sata_mv.c	2009-01-30 18:32:08.000000000 -0500
@@ -1364,12 +1364,13 @@
			u32 offset = addr & 0xffff;
			u32 len = sg_len;

-			if ((offset + sg_len > 0x10000))
+			if (offset + len > 0x10000)
				len = 0x10000 - offset;

			mv_sg->addr = cpu_to_le32(addr & 0xffffffff);
			mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
			mv_sg->flags_size = cpu_to_le32(len & 0xffff);
+			mv_sg->reserved = 0;

			sg_len -= len;
			addr += len;
@@ -1381,6 +1382,7 @@

	if (likely(last_sg))
		last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
+	mb(); /* ensure data structure is visible to the chipset */
}

static void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux