All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Millan <jessem@cs.pdx.edu>
To: kernel-janitors@vger.kernel.org
Subject: [KJ]
Date: Fri, 03 Jun 2005 18:43:39 +0000	[thread overview]
Message-ID: <42A0A4DB.7060303@cs.pdx.edu> (raw)
In-Reply-To: <1106245529.15916.12.camel@base.torri.org>

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

The function ext2_set_acl() declares a size_t called 'size' without
setting it to an initial value. 'size' is not referred to again until
you see:

if (acl) {
	// Email KJ comments: size IS initialized in this function
	// only if acl != NULL
	value = ext2_acl_to_disk(acl, &size);
	...
}

// Email KJ comments: If acl == NULL, size is passed to
// this function uninitialized.
error = ext2_xattr_set(inode, name_index, "", value, size, 0);
...

The external function ext2_xattr_set() does not seem to use size in any
meaningful way... but depending on some other parameters, it looks like
'size' could be read without being initialized.

Initializing 'size' to zero eliminates the compiler warning and the
possibility of passing an uninitialized variable around.

*Note unlike previous patches, initializing 'size' in the function
ext2_acl_to_disk() does not eliminate this particular warning. This is
because of the conditional call to the function that initializes it.




[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 424 bytes --]

Signed-off-by: Jesse Millan <jessem@cs.pdx.edu>

--- linux-2.6.12-rc5.kj/fs/ext2/acl.c~	2005-06-01 16:46:22.139160702 -0700
+++ linux-2.6.12-rc5.kj/fs/ext2/acl.c	2005-06-03 10:40:36.828178073 -0700
@@ -220,7 +220,7 @@ ext2_set_acl(struct inode *inode, int ty
 	struct ext2_inode_info *ei = EXT2_I(inode);
 	int name_index;
 	void *value = NULL;
-	size_t size;
+	size_t size = 0;
 	int error;

 	if (S_ISLNK(inode->i_mode))


[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

  reply	other threads:[~2005-06-03 18:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-20 18:25 [KJ] Stephen torri
2005-06-03 18:43 ` Jesse Millan [this message]
2005-10-29 13:09 ` [KJ] Tobias Klauser
2005-11-12 14:55 ` [KJ] Alexey Dobriyan
2006-07-31  6:51 ` [KJ] Henne
2006-07-31 19:51 ` [KJ] Patrik Kullman
2006-07-31 19:58 ` [KJ] Patrik Kullman

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=42A0A4DB.7060303@cs.pdx.edu \
    --to=jessem@cs.pdx.edu \
    --cc=kernel-janitors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.