firehose: Prevent potential overflow in info print

also fixes the improper format specifier i suppose

CodeQL reports:

Multiplication result may overflow 'unsigned int' before it is converted to 'long'.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
This commit is contained in:
Konrad Dybcio
2024-05-15 00:43:31 +02:00
committed by Bjorn Andersson
parent b1ec56fc9e
commit aeb70e0645

View File

@@ -417,9 +417,9 @@ static int firehose_program(struct qdl_device *qdl, struct program *program, int
fprintf(stderr, "[PROGRAM] failed\n");
} else if (t) {
fprintf(stderr,
"[PROGRAM] flashed \"%s\" successfully at %ldkB/s\n",
"[PROGRAM] flashed \"%s\" successfully at %lukB/s\n",
program->label,
program->sector_size * num_sectors / t / 1024);
(unsigned long)program->sector_size * num_sectors / t / 1024);
} else {
fprintf(stderr, "[PROGRAM] flashed \"%s\" successfully\n",
program->label);