ref: 369d54c6e963ece750a3b6008cabe26c4222e99e
parent: 26925318e5a5af67e9aaf90fdbbf5672339861a8
author: 7heo <7heo@mail.com>
date: Tue Jul 5 20:56:18 CDT 2016
nlplug-findfs: alloca isn't POSIX, use stack
--- a/nlplug-findfs.c
+++ b/nlplug-findfs.c
@@ -560,6 +560,7 @@
{
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;
@@ -566,9 +567,9 @@
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_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);