ACK: [PATCH] acpi: cstates: set state->present[nr] if nr < MAX_CSTATE
Alex Hung
alex.hung at canonical.com
Fri May 10 01:07:11 UTC 2013
On 05/07/2013 08:13 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Coverity CID #997274, Out-of-bounds write (OVERRUN)
>
> We can get an out of bounds write on state->present[] if
> nr >= MAX_CSTATE, so guard against this. We already do this
> for state->counts[].
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/acpi/cstates/cstates.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c
> index 93a7e50..90b5c03 100644
> --- a/src/acpi/cstates/cstates.c
> +++ b/src/acpi/cstates/cstates.c
> @@ -100,10 +100,10 @@ static void get_cstates(char *path, fwts_cstates *state)
> count = strtoull(data, NULL, 10);
> free(data);
>
> - if ((nr>=0) && (nr < MAX_CSTATE))
> + if ((nr >= 0) && (nr < MAX_CSTATE)) {
> state->counts[nr] = count;
> -
> - state->present[nr] = true;
> + state->present[nr] = true;
> + }
> }
> }
> closedir(dir);
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list