]> www.infradead.org Git - mtd-utils.git/commitdiff
mtd-utils: Fix wrong argument to sizeof in nanddump
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Fri, 24 Jan 2020 22:57:40 +0000 (23:57 +0100)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Sun, 9 Feb 2020 21:13:18 +0000 (22:13 +0100)
Some temporary buffers are allocated with "sizeof(pointer) * count" as
size argument, which cannot possibly be correct.

Assuming what was meant was "sizeof(pointer[0]) * count" makes sense
in the context of how the buffers are used, but is actually pretty
pointless, since the buffers are unsigend char.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
nand-utils/nanddump.c

index 62699e079678e256fd2b8d950834cd4f9a852d2f..d7fc3205750d3d091508e96f15de18f7425d72d1 100644 (file)
@@ -362,8 +362,8 @@ int main(int argc, char * const argv[])
                return errmsg("mtd_get_dev_info failed");
 
        /* Allocate buffers */
-       oobbuf = xmalloc(sizeof(oobbuf) * mtd.oob_size);
-       readbuf = xmalloc(sizeof(readbuf) * mtd.min_io_size);
+       oobbuf = xmalloc(mtd.oob_size);
+       readbuf = xmalloc(mtd.min_io_size);
 
        if (noecc)  {
                if (ioctl(fd, MTDFILEMODE, MTD_FILE_MODE_RAW) != 0) {