[lxc-devel] [PATCH 1/6] coverity: Check fread length

Serge Hallyn serge.hallyn at ubuntu.com
Fri Feb 14 23:57:06 UTC 2014


Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/lxc/console.c | 2 +-
>  src/lxc/lxcutmp.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lxc/console.c b/src/lxc/console.c
> index 55e895c..6bfc8a3 100644
> --- a/src/lxc/console.c
> +++ b/src/lxc/console.c
> @@ -116,7 +116,7 @@ static int lxc_console_cb_sigwinch_fd(int fd, uint32_t events, void *cbdata,
>  	struct signalfd_siginfo siginfo;
>  	struct lxc_tty_state *ts = cbdata;
>  
> -	if (read(fd, &siginfo, sizeof(siginfo)) < 0) {
> +	if (read(fd, &siginfo, sizeof(siginfo)) < sizeof(siginfo)) {
>  		ERROR("failed to read signal info");
>  		return -1;
>  	}
> diff --git a/src/lxc/lxcutmp.c b/src/lxc/lxcutmp.c
> index 24cfa75..ba65654 100644
> --- a/src/lxc/lxcutmp.c
> +++ b/src/lxc/lxcutmp.c
> @@ -167,7 +167,7 @@ static int utmp_handler(int fd, uint32_t events, void *data,
>  		return -1;
>  	}
>  
> -	if (read(fd, buffer, size) < 0) {
> +	if (read(fd, buffer, size) < size) {
>  		SYSERROR("failed to read notification");
>  		return -1;
>  	}
> -- 
> 1.9.rc1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list