debug.c (e3c55d406bd8df1a878546002c93db90c42be10c) | debug.c (58a4e23703b22c331b01fbd0c12161aadaa6d50b) |
---|---|
1/* 2 * This file is part of UBIFS. 3 * 4 * Copyright (C) 2006-2008 Nokia Corporation 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 2549 unchanged lines hidden (view full) --- 2558} 2559 2560static int corrupt_data(const struct ubifs_info *c, const void *buf, 2561 unsigned int len) 2562{ 2563 unsigned int from, to, ffs = chance(1, 2); 2564 unsigned char *p = (void *)buf; 2565 | 1/* 2 * This file is part of UBIFS. 3 * 4 * Copyright (C) 2006-2008 Nokia Corporation 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 2549 unchanged lines hidden (view full) --- 2558} 2559 2560static int corrupt_data(const struct ubifs_info *c, const void *buf, 2561 unsigned int len) 2562{ 2563 unsigned int from, to, ffs = chance(1, 2); 2564 unsigned char *p = (void *)buf; 2565 |
2566 from = prandom_u32() % (len + 1); 2567 /* Corruption may only span one max. write unit */ 2568 to = min(len, ALIGN(from, c->max_write_size)); | 2566 from = prandom_u32() % len; 2567 /* Corruption span max to end of write unit */ 2568 to = min(len, ALIGN(from + 1, c->max_write_size)); |
2569 2570 ubifs_warn("filled bytes %u-%u with %s", from, to - 1, 2571 ffs ? "0xFFs" : "random data"); 2572 2573 if (ffs) 2574 memset(p + from, 0xFF, to - from); 2575 else 2576 prandom_bytes(p + from, to - from); --- 538 unchanged lines hidden --- | 2569 2570 ubifs_warn("filled bytes %u-%u with %s", from, to - 1, 2571 ffs ? "0xFFs" : "random data"); 2572 2573 if (ffs) 2574 memset(p + from, 0xFF, to - from); 2575 else 2576 prandom_bytes(p + from, to - from); --- 538 unchanged lines hidden --- |