From 369d54c6e963ece750a3b6008cabe26c4222e99e Mon Sep 17 00:00:00 2001 From: 7heo <7heo@mail.com> Date: Wed, 6 Jul 2016 01:56:18 +0200 Subject: nlplug-findfs: alloca isn't POSIX, use stack --- nlplug-findfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nlplug-findfs.c b/nlplug-findfs.c index 68675bc..390a51b 100644 --- a/nlplug-findfs.c +++ b/nlplug-findfs.c @@ -560,15 +560,16 @@ static void *cryptsetup_thread(void *data) { struct ueventconf *c = (struct ueventconf *)data; const char *data_devnode, *header_devnode; + struct crypt_params_luks1 param_struct; struct crypt_params_luks1 *params = NULL; struct crypt_device *cd; int r, passwd_tries = 5; data_devnode = header_devnode = c->crypt.data.devnode; - if(c->crypt.header.devnode != NULL && c->crypt.header.devnode[0] != '\0') { - params = alloca(sizeof(struct crypt_params_luks1)); - memset(params, 0, sizeof(struct crypt_params_luks1)); + if(c->crypt.header.devnode[0] != '\0') { + params = ¶m_struct; + params->hash = NULL; /* No way of finding this */ params->data_alignment = c->crypt.payload_offset; /* Memset did set that to 0, so default is 0 */ params->data_device = c->crypt.data.devnode; header_devnode = c->crypt.header.devnode; @@ -631,7 +632,7 @@ static void start_thread(struct ueventconf *conf, void *(*thread_main)(void *)) static void start_cryptsetup(struct ueventconf *conf) { - if(conf->crypt.header.devnode != NULL) { + if(conf->crypt.header.devnode[0] != '\0') { dbg("starting cryptsetup %s -> %s (header: %s)", conf->crypt.data.devnode, conf->crypt.data.name, conf->crypt.header.devnode); -- cgit v1.2.3