Skip to content

Commit

Permalink
libata: clear PIO pad area
Browse files Browse the repository at this point in the history
ata_sff_data_xfer[32]() use pad area if the transfer size isn't
multiple of transfer size; however, this area wasn't cleared and
garbage data in pad area could be transferred to the device.  Make
sure the pad area is cleared.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Lei Ming <tom.leiming@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Oct 8, 2011
1 parent d866192 commit 21dba24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/ata/libata-sff.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf,

/* Transfer trailing byte, if any. */
if (unlikely(buflen & 0x01)) {
unsigned char pad[2];
unsigned char pad[2] = { };

/* Point buf to the tail of buffer */
buf += buflen - 1;
Expand Down Expand Up @@ -628,7 +628,7 @@ unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf,

/* Transfer trailing bytes, if any */
if (unlikely(slop)) {
unsigned char pad[4];
unsigned char pad[4] = { };

/* Point buf to the tail of buffer */
buf += buflen - slop;
Expand Down

0 comments on commit 21dba24

Please sign in to comment.