linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] Fix uninitialized name_list::ignore_error
Date: Sun, 31 Aug 2008 17:22:21 +0000	[thread overview]
Message-ID: <48BAD34D.7010105@tuffmail.co.uk> (raw)

Running udevd under valgrind (and then udevtrigger):

=17705= Conditional jump or move depends on uninitialised value(s)
=17705=    at 0x407BBB: udev_rules_run (udev_rules.c:522)
=17705=    by 0x4109F0: udev_event_process (udevd.c:145)
=17705=    by 0x410E2C: udev_event_run (udevd.c:251)
=17705=    by 0x411A8D: msg_queue_manager (udevd.c:581)
=17705=    by 0x41386B: main (udevd.c:1284)

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>

diff --git a/udev/udev_utils.c b/udev/udev_utils.c
index 9b22de7..d1d3acb 100644
--- a/udev/udev_utils.c
+++ b/udev/udev_utils.c
@@ -77,6 +77,7 @@ struct name_entry *name_list_add(struct list_head *name_list, const char *name,
 	name_new = malloc(sizeof(struct name_entry));
 	if (name_new = NULL)
 		return NULL;
+	memset(name_new, 0x00, sizeof(struct name_entry));
 
 	strlcpy(name_new->name, name, sizeof(name_new->name));
 	dbg("adding '%s'\n", name_new->name);
@@ -102,6 +103,7 @@ struct name_entry *name_list_key_add(struct list_head *name_list, const char *ke
 	name_new = malloc(sizeof(struct name_entry));
 	if (name_new = NULL)
 		return NULL;
+	memset(name_new, 0x00, sizeof(struct name_entry));
 
 	snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value);
 	name_new->name[sizeof(name_new->name)-1] = '\0';



             reply	other threads:[~2008-08-31 17:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-31 17:22 Alan Jenkins [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-09-01 14:37 [PATCH] Fix uninitialized name_list::ignore_error Kay Sievers

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=48BAD34D.7010105@tuffmail.co.uk \
    --to=alan-jenkins@tuffmail.co.uk \
    --cc=linux-hotplug@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).