[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20070529195227.GG6815@fieldses.org>
Date: Tue, 29 May 2007 15:52:27 -0400
From: "J. Bruce Fields" <bfields@...ldses.org>
To: Jeff Garzik <jeff@...zik.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, neilb@...e.de,
nfs@...ts.sourceforge.net, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [NFS] [PATCH] NFSD: fix uninitialized variable
On Mon, May 28, 2007 at 11:19:21PM -0400, Jeff Garzik wrote:
> J. Bruce Fields wrote:
> >But I don't want anyone else wasting their time on this. Should we cave
> >in and add the initialization here just to shut up gcc? Or would a
> >comment here help?
>
> Given what you said above, I don't see gcc, on its best day, will ever
> know enough to validate that that variable is indeed always initialized.
I recall there being arguments before about when to add initializations.
Unfortunately I can't remember the content of those arguments. But I
thought that on the gcc-haters side the complaint was exactly that gcc
was emitting warnings in cases where it could never hope to determine
whether an initialization is required. Am I misremembering?
> So I would vote for silencing it on those grounds.
That said, I'm OK with the extra initialization. Might be worth a
comment, though, just to avoid giving the wrong impression about the
assumptions here; something like:
--b.
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index cc3b7ba..4adb5ee 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -183,8 +183,13 @@ static void
summarize_posix_acl(struct posix_acl *acl, struct posix_acl_summary *pas)
{
struct posix_acl_entry *pa, *pe;
- pas->users = 0;
- pas->groups = 0;
+
+ /*
+ * Only pas.users and pas.groups need initialization; previous
+ * posix_acl_valid() calls ensure that the other fields will be
+ * initialized in the following loop. But, just to placate gcc:
+ */
+ memset(pas, 0, sizeof(*pas));
pas->mask = 07;
pe = acl->a_entries + acl->a_count;
-
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