Skip to content
Commit 756b6192 authored by Lloyd Pique's avatar Lloyd Pique Committed by Commit Bot
Browse files

arc: Fix sscanf format strings for uint32_t

sscanf() was being used with "%d" to read data into an unsigned integer
destination. If the value being read was greater than INT_MAX, the value
was clamped to INT_MAX.

This affected the reading of the idle "state" value, which can be 4294967295 (UINT_MAX).

Unfortunately "-Wformat" does not seem to catch this problem.

For safety, switch to using the format specifiers from inttypes.h, and
use SCNu32 whenever a uint32_t is read. I assumed that all places that
read a uint32_t really did want an unsigned 32 bit integer.

TEST=Locally
BUG=b:132637438

Change-Id: Ifb8627998152a1a8ef61a9974bc99db445580ea7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612699


Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Auto-Submit: Lloyd Pique <lpique@chromium.org>
Commit-Queue: Lloyd Pique <lpique@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660182}
parent 7920934a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment