Skip to content

Commit

Permalink
firehose: Prevent potential overflow in info print
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
konradybcio committed May 14, 2024
1 parent 6622f25 commit 766123c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firehose.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 766123c

Please sign in to comment.