From: Christian Brauner Date: Wed, 24 Feb 2021 15:48:23 +0000 (+0100) Subject: commands: ensure that non-NULL and MAX_STATE is always passed X-Git-Tag: lxc-5.0.0~268^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3695%2Fhead;p=thirdparty%2Flxc.git commands: ensure that non-NULL and MAX_STATE is always passed Signed-off-by: Christian Brauner --- diff --git a/src/lxc/commands.c b/src/lxc/commands.c index da379b9db..9685cfa2e 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -1280,7 +1280,7 @@ static int lxc_cmd_get_lxcpath_callback(int fd, struct lxc_cmd_req *req, } int lxc_cmd_add_state_client(const char *name, const char *lxcpath, - lxc_state_t states[MAX_STATE], + lxc_state_t states[static MAX_STATE], int *state_client_fd) { __do_close int clientfd = -EBADF; diff --git a/src/lxc/commands.h b/src/lxc/commands.h index de17b5663..8d99d5e06 100644 --- a/src/lxc/commands.h +++ b/src/lxc/commands.h @@ -112,8 +112,10 @@ __hidden extern int lxc_cmd_stop(const char *name, const char *lxcpath); * via socket fd * < MAX_STATE current container state */ -__hidden extern int lxc_cmd_add_state_client(const char *name, const char *lxcpath, - lxc_state_t states[MAX_STATE], int *state_client_fd); +__hidden __access_r_nosize(3) extern int lxc_cmd_add_state_client(const char *name, + const char *lxcpath, + lxc_state_t states[static MAX_STATE], + int *state_client_fd); __hidden extern int lxc_cmd_serve_state_clients(const char *name, const char *lxcpath, lxc_state_t state); diff --git a/src/lxc/compiler.h b/src/lxc/compiler.h index 89286eab6..81cab5c43 100644 --- a/src/lxc/compiler.h +++ b/src/lxc/compiler.h @@ -60,6 +60,7 @@ #define __cgfsng_ops /* access attribute */ +#define __access_r_nosize(x) #define __access_r(x, y) #define __access_w(x, y) #define __access_rw(x, y) @@ -69,6 +70,9 @@ #undef __access_r #define __access_r(x, y) __attribute__((access(read_only, x, y))) +#undef __access_r_nosize +#define __access_r_nosize(x) __attribute__((access(read_only, x))) + #undef __access_w #define __access_w(x, y) __attribute__((access(write_only, x, y)))