freemyipod r627 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r626‎ | r627 | r628 >
Date:16:10, 18 February 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Reject misaligned buffers in the iPod Classic ATA driver
Modified paths:
  • /emcore/trunk/target/ipodclassic/storage_ata.c (modified) (history)

Diff [purge]

Index: emcore/trunk/target/ipodclassic/storage_ata.c
@@ -432,6 +432,10 @@
433433
434434 int ata_rw_sectors(uint64_t sector, uint32_t count, void* buffer, bool write)
435435 {
 436+ if (((uint32_t)buffer) & (CACHEALIGN_SIZE - 1))
 437+ panicf(PANIC_KILLTHREAD,
 438+ "ATA: Misaligned data buffer at %08X (sector %lu, count %lu)",
 439+ (unsigned int)buffer, (unsigned int)sector, count);
436440 #ifdef ATA_HAVE_BBT
437441 if (sector + count > ata_virtual_sectors) RET_ERR(0);
438442 if (ata_bbt)