xen/xenbus: fix overflow check in xenbus_file_write()
Acked-by: Ian Campbell <ian.campbell@citrix.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> [v1: Rebased on upstream] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
This commit is contained in:
parent
2ebb939ab9
commit
1bcaba51eb
|
@ -458,7 +458,7 @@ static ssize_t xenbus_file_write(struct file *filp,
|
|||
goto out;
|
||||
|
||||
/* Can't write a xenbus message larger we can buffer */
|
||||
if ((len + u->len) > sizeof(u->u.buffer)) {
|
||||
if (len > sizeof(u->u.buffer) - u->len) {
|
||||
/* On error, dump existing buffer */
|
||||
u->len = 0;
|
||||
rc = -EINVAL;
|
||||
|
|
Loading…
Reference in New Issue
Block a user