From patchwork Mon Oct 11 17:24:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 67459 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 66C17B6EFF for ; Tue, 12 Oct 2010 04:24:50 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755390Ab0JKRYm (ORCPT ); Mon, 11 Oct 2010 13:24:42 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:36126 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753167Ab0JKRYl (ORCPT ); Mon, 11 Oct 2010 13:24:41 -0400 Received: by wye20 with SMTP id 20so642413wye.19 for ; Mon, 11 Oct 2010 10:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=kFSvRBAxUKgfTwMUI/kTZ4JOQvwtn7ilbyKsk6LhXl0=; b=MSqnD7e2qizLWqIMlpRHK8HBK0amqpXJt08HuATMaFImp+pb5feYDEHZpkht7mIMot v3WZ5LNj99cVanDSDyueBZQUroAp2zoDUSCi4ibiHGupeJedMgLIb0x8KmWHOsBKU6UZ pESGr1hK4K0rT4ohhV6+2qyUQeLqBCjRcalUo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=xJV4w87lrrGqNRWLIZh3LGaRGnLDF5+vuCd+UUUM8l3vi/wGsH6eC9U+uU7FDG6hBG OJiqDvGlBwAGrz8X7km71LnYrH84DqUEY7eNWkkpKYAx4eCGiBM4VPn0tQwAftNBhBD0 bjIxnyL2Ox2fJBIOlyzZPODxXPYM/2qitZPVI= Received: by 10.216.161.17 with SMTP id v17mr3858831wek.1.1286817879382; Mon, 11 Oct 2010 10:24:39 -0700 (PDT) Received: from bicker (h3f05.n1.ips.mtn.co.ug [41.210.191.5]) by mx.google.com with ESMTPS id e56sm4574142wer.46.2010.10.11.10.24.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 11 Oct 2010 10:24:31 -0700 (PDT) Date: Mon, 11 Oct 2010 19:24:19 +0200 From: Dan Carpenter To: "Michael S. Tsirkin" Cc: Juan Quintela , "David S. Miller" , Rusty Russell , kvm@vger.kernel.org, virtualization@lists.osdl.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch 2/2] vhost: fix return code for log_access_ok() Message-ID: <20101011172419.GG5851@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org access_ok() returns 1 if it's OK otherwise it should return 0. Signed-off-by: Dan Carpenter Acked-by: Michael S. Tsirkin --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c2aa12c..f82fe57 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -371,7 +371,7 @@ static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz) /* Make sure 64 bit math will not overflow. */ if (a > ULONG_MAX - (unsigned long)log_base || a + (unsigned long)log_base > ULONG_MAX) - return -EFAULT; + return 0; return access_ok(VERIFY_WRITE, log_base + a, (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8);