Skip to content

Commit

Permalink
perf-counter: use 'int' instead of size_t
Browse files Browse the repository at this point in the history
'size_t' does not allow for catching the case where 'read' returns
an error code, which is a negative number.

Reported-by: Ben Pfaff <[email protected]>
Signed-off-by: Andy Zhou <[email protected]>
  • Loading branch information
azhou-nicira committed Apr 15, 2015
1 parent 296527d commit 8c0294b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/perf-counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static int fd__ = 0;
uint64_t
perf_counter_read(uint64_t *counter)
{
size_t size = sizeof *counter;
int size = sizeof *counter;

if (fd__ <= 0 || read(fd__, counter, size) < size) {
*counter = 0;
Expand Down

0 comments on commit 8c0294b

Please sign in to comment.