[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8bd0f97a0911020500r793d7414mb55c2ec8c62250f4@mail.gmail.com>
Date: Mon, 2 Nov 2009 08:00:53 -0500
From: Mike Frysinger <vapier.adi@...il.com>
To: Roel Kluin <roel.kluin@...il.com>
Cc: uclinux-dist-devel@...ckfin.uclinux.org,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Blackfin arch: ensure index is positive
On Mon, Nov 2, 2009 at 06:09, Roel Kluin wrote:
> The indices are signed, it's not negative before we read an
> array element.
>
> Found by code analysis, is this required?
>
> --- a/arch/blackfin/kernel/gptimers.c
> +++ b/arch/blackfin/kernel/gptimers.c
> @@ -139,7 +139,7 @@ static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] =
>
> void set_gptimer_pwidth(int timer_id, uint32_t value)
> {
> - tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
> + tassert(timer_id < MAX_BLACKFIN_GPTIMERS && timer_id >= 0);
the gptimer API is supposed to use symbolic defines only (TIMER#_id),
but that doesnt mean people couldnt pass in negative numbers
themselves. but rather than fix it this way, i'll change the API to
use unsigned ints.
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists