freemyipod r213 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r212‎ | r213 | r214 >
Date:19:47, 28 September 2010
Author:theseven
Status:new
Tags:
Comment:
Prevent a division by zero in the FTL repair code for ipodnano2g if the erase counter table is completely gone.
Modified paths:
  • /embios/trunk/target/ipodnano2g/ftl.c (modified) (history)

Diff [purge]

Index: embios/trunk/target/ipodnano2g/ftl.c
@@ -2331,7 +2331,8 @@
23322332 sum += ftl_erasectr[i];
23332333 count++;
23342334 }
2335 - uint32_t average = sum / count;
 2335+ uint32_t average = 0;
 2336+ if (count) average = sum / count;
23362337 for (i = 0; i < 0x2000; i++)
23372338 if (!ftl_erasectr[i])
23382339 ftl_erasectr[i] = average;