diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2012-01-22 10:50:40 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2012-01-22 10:50:40 +0000 |
commit | e8ecb71d2f8ede42f41552d3df445d2ad527133b (patch) | |
tree | 329723f067966c4c8cef8bf09ca6ddd19686a516 /sys/dev/softraid_crypto.c | |
parent | 8cb02b792482b0372d518660c600b0e9fab9e267 (diff) |
Move list initialisation to the start of the function - this prevents us
from walking an uninitialised list if we fail to read the key disk.
Diffstat (limited to 'sys/dev/softraid_crypto.c')
-rw-r--r-- | sys/dev/softraid_crypto.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c index 1e8b55096b6..4ba1328c340 100644 --- a/sys/dev/softraid_crypto.c +++ b/sys/dev/softraid_crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_crypto.c,v 1.77 2011/12/26 14:54:52 jsing Exp $ */ +/* $OpenBSD: softraid_crypto.c,v 1.78 2012/01/22 10:50:39 jsing Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org> @@ -827,6 +827,8 @@ sr_crypto_read_key_disk(struct sr_discipline *sd, dev_t dev) * Load a key disk and load keying material into memory. */ + SLIST_INIT(&som); + sr_meta_getdevname(sc, dev, devname, sizeof(devname)); /* Make sure chunk is not already in use. */ @@ -898,7 +900,6 @@ sr_crypto_read_key_disk(struct sr_discipline *sd, dev_t dev) sizeof(key_disk->src_meta)); /* Read mask key from optional metadata. */ - SLIST_INIT(&som); sr_meta_opt_load(sc, sm, &som); SLIST_FOREACH(omi, &som, omi_link) { omh = omi->omi_som; |