From: Dibyendu Roy Date: Mon, 6 Jul 2015 13:30:53 +0530 Subject: [PATCH] Bluetooth: Fix static analysis issues Change-Id: Ida91f012544c39a8aaa6e7db23f1d5b68d3bec08 --- tools/hciattach_rome.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c index 1891de24e21a..59bdc16e4e8f 100644 --- a/tools/hciattach_rome.c +++ b/tools/hciattach_rome.c @@ -933,7 +933,13 @@ int rome_get_tlv_file(char *file_path) /* Get File Size */ fseek (pFile , 0 , SEEK_END); - fileSize = ftell (pFile); + + if((fileSize = ftell(pFile)) < 0) { + fprintf(stderr, "%s: fail to get current file position\n", file_path); + fclose (pFile); + return -1; + } + rewind (pFile); pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize); @@ -1107,7 +1113,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc int rome_tlv_dnld_req(int fd, int tlv_size) { int total_segment, remain_size, i, err = -1; - unsigned char wait_cc_evt; + unsigned char wait_cc_evt = FALSE; unsigned int rom = rome_ver >> 16; total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT;