mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier.adi@gmail.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: uclinux-dist-devel@blackfin.uclinux.org,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Blackfin arch: ensure index is positive
Date: Mon, 2 Nov 2009 08:00:53 -0500	[thread overview]
Message-ID: <8bd0f97a0911020500r793d7414mb55c2ec8c62250f4@mail.gmail.com> (raw)
In-Reply-To: <4AEEBDD8.5080808@gmail.com>

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

      reply	other threads:[~2009-11-02 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-02 11:09 Roel Kluin
2009-11-02 13:00 ` Mike Frysinger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8bd0f97a0911020500r793d7414mb55c2ec8c62250f4@mail.gmail.com \
    --to=vapier.adi@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®