The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: dhowells@redhat.com, keyrings@linux-nfs.org,
	linux-security-module@vger.kernel.org, "open list\:NFS\, SUNRPC\,
	AND..." <linux-nfs@vger.kernel.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: assoc_array.c uninitialized variable (was: Re: [PATCH 02/10] Add a generic associative array implementation.)
Date: Mon, 25 Nov 2013 09:36:29 +0000	[thread overview]
Message-ID: <19201.1385372189@warthog.procyon.org.uk> (raw)
In-Reply-To: <CAMuHMdUiK4CHXESCEYvGJfE1ROGa=MC_c=qAQgKVS7GmkBXz=Q@mail.gmail.com>

Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> > +       int slot, next_slot, free_slot, i, j;
> 
> lib/assoc_array.c: In function ‘assoc_array_insert_into_terminal_node’:
> lib/assoc_array.c:502: warning: ‘j’ may be used uninitialized in this function

What compiler are you using?  Mine doesn't show this.

Technically, the compiler is correct - but we should never see the variable
undefined following the found_slot_for_multiple_occupancy unless the tree
changes under us. Out of a set of N+1 integers that can only be in the range
0..N-1 there must be at least two the same.

I guess I could preclear j to make the warning go away.

David

  reply	other threads:[~2013-11-25  9:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-23 12:09 assoc_array.c uninitialized variable (was: Re: [PATCH 02/10] Add a generic associative array implementation.) Geert Uytterhoeven
2013-11-25  9:36 ` David Howells [this message]
2013-11-25 10:05   ` Geert Uytterhoeven

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=19201.1385372189@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=geert@linux-m68k.org \
    --cc=keyrings@linux-nfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=torvalds@linux-foundation.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