dfu: fix readback buffer overflow test
authorStephen Warren <swarren@nvidia.com>
Tue, 1 Jul 2014 18:16:57 +0000 (12:16 -0600)
committerChanho Park <chanho61.park@samsung.com>
Fri, 24 Jul 2015 07:30:01 +0000 (16:30 +0900)
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 d1cc212a9b4ace1020e88c5c828aa7b3ad421dd2..4368a514d3d956906b19d8fcb38e7e428a2eae85 100644 (file)
@@ -344,7 +344,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;