Date: Mon, 19 Jan 2015 23:08:59 +0100
Fix the warning below found by Clang’s static analyzer scan-build 3.6 and use `sizeof(unsigned char)` as the size argument.
flashrom.c:1304:23: warning: Result of 'calloc' is converted to a pointer of type 'unsigned char', which is incompatible with sizeof operand type 'char' unsigned char *buf = calloc(size, sizeof(char)); ~~~~~~~~~~~~~~~ ^~~~~~ ~~~~~~~~~~~~ 1 warning generated.
Signed-off-by: Paul Menzel paulepanter@users.sourceforge.net --- flashrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flashrom.c b/flashrom.c index 9df1478..5ef22b0 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1301,7 +1301,7 @@ int write_buf_to_file(const unsigned char *buf, unsigned long size, const char * int read_flash_to_file(struct flashctx *flash, const char *filename) { unsigned long size = flash->chip->total_size * 1024; - unsigned char *buf = calloc(size, sizeof(char)); + unsigned char *buf = calloc(size, sizeof(unsigned char)); int ret = 0;
msg_cinfo("Reading flash... ");