"erase /dev/myflash0.mypart 0xf0000+0xf0000" could erase past the end of the partition. Signed-off-by: Johannes Stezenbach <js@xxxxxxxxx> --- fs/devfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/devfs.c b/fs/devfs.c index e3a21ae..ae48451 100644 --- a/fs/devfs.c +++ b/fs/devfs.c @@ -73,6 +73,9 @@ static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, unsigned lo if (!cdev->ops->erase) return -ENOSYS; + if (count + offset > cdev->size) + count = cdev->size - offset; + return cdev->ops->erase(cdev, count, offset + cdev->offset); } -- 1.7.10 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox