Commit d96d0f96 authored by Paulo Miguel Almeida's avatar Paulo Miguel Almeida Committed by David Teigland

dlm: replace one-element array with fixed size array

One-element arrays are deprecated. So, replace one-element array with
fixed size array member in struct dlm_ls, and refactor the rest of the
code, accordingly.

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/228
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836
Link: https://lore.kernel.org/lkml/Y0W5jkiXUkpNl4ap@mail.google.com/Signed-off-by: default avatarPaulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Reviewed-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent f0c4d9fc
......@@ -670,7 +670,7 @@ struct dlm_ls {
void *ls_ops_arg;
int ls_namelen;
char ls_name[1];
char ls_name[DLM_LOCKSPACE_LEN + 1];
};
/*
......
......@@ -473,7 +473,7 @@ static int new_lockspace(const char *name, const char *cluster,
error = -ENOMEM;
ls = kzalloc(sizeof(struct dlm_ls) + namelen, GFP_NOFS);
ls = kzalloc(sizeof(*ls), GFP_NOFS);
if (!ls)
goto out;
memcpy(ls->ls_name, name, namelen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment