samples: fs: Fix possible integer overflow

We are doing math of two 32-bit numbers and assigning into a 64-bit
result.  Add explicit cast of one of the values being multipled to get
explicit promotion.

Fixes: #13883
Coverity CID: 190930

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2019-02-27 08:40:50 -06:00 committed by Anas Nashif
parent 11b3dce674
commit 9fa8674239

View file

@ -58,7 +58,7 @@ void main(void)
}
printk("Sector size %u\n", block_size);
memory_size_mb = block_count * block_size;
memory_size_mb = (u64_t)block_count * block_size;
printk("Memory Size(MB) %u\n", (u32_t)memory_size_mb>>20);
} while (0);