]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dfu: fix readback buffer overflow test
authorStephen Warren <swarren@nvidia.com>
Tue, 1 Jul 2014 18:16:57 +0000 (12:16 -0600)
committerTom Rini <trini@ti.com>
Sat, 9 Aug 2014 15:17:01 +0000 (11:17 -0400)
The buffer is too small if it's < size to read, not if it's <= the size.
This fixes the 1MB test case on Tegra, which has a 1MB buffer.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
drivers/dfu/dfu.c

index 6cd3fbb58ae4a6e1f13a4125b8dc536b521fb8ab..3512b149c560fc7fa32fa169bbfbd9ac70875bda 100644 (file)
@@ -332,7 +332,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
                case DFU_RAM_ADDR:
                        break;
                default:
-                       if (dfu->r_left >= dfu_buf_size) {
+                       if (dfu->r_left > dfu_buf_size) {
                                printf("%s: File too big for buffer\n",
                                       __func__);
                                return -EOVERFLOW;