From patchwork Wed Oct 14 15:32:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 35981 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 72803B7DC8 for ; Thu, 15 Oct 2009 02:23:16 +1100 (EST) Received: from ey-out-1920.google.com (ey-out-1920.google.com [74.125.78.148]) by ozlabs.org (Postfix) with ESMTP id 618F8B7B72; Thu, 15 Oct 2009 02:23:06 +1100 (EST) Received: by ey-out-1920.google.com with SMTP id 3so2053926eyh.38 for ; Wed, 14 Oct 2009 08:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=uXaRBHkT1Je+LVwyWAonQhd4f5vXvPQ5ovyyiMdbVAw=; b=MidK3Mrgjwuk47QiOK/pDf43TXeZYORpHrTXIsmo8aW1ZrjotgDlKjRql80WpByJED z4AH5MaSa3+Oo9OAmUuBejde1d3Mg2ys5Dk3duOrRfMq1FgMVgfoAKouQmr9Dnt/AODV lSfXwzqczqAkgKpmbYBacF/uv3dUzMYvLHciY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=x3O5JmFDLjPPzs/IaBiEbK7T5B7fwjPvnZobX6b8CRf2HkzXEmD209za032TkTKQTM 28MIwTHqFk9XoSMs9wORrDtF4RQzWjUUBz66/P+PeH3HxUDTMQoVQ1fh/fYRyX4qsnx4 jjDVbAsCrOEv5tixGjvE8XWXMl7gC8Vy+HkQA= Received: by 10.211.130.13 with SMTP id h13mr7485448ebn.13.1255533783589; Wed, 14 Oct 2009 08:23:03 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 7sm6597513eyb.16.2009.10.14.08.23.00 (version=SSLv3 cipher=RC4-MD5); Wed, 14 Oct 2009 08:23:01 -0700 (PDT) Message-ID: <4AD5EF0C.9050603@gmail.com> Date: Wed, 14 Oct 2009 17:32:28 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-2.7.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: Arnd Bergmann Subject: Re: [Cbe-oss-dev] [PATCH] spufs: Fix test in spufs_switch_log_read() References: <4AD32B3F.9060804@gmail.com> <200910130849.56671.jk@ozlabs.org> <200910131531.45726.arnd@arndb.de> In-Reply-To: <200910131531.45726.arnd@arndb.de> Cc: cbe-oss-dev@lists.ozlabs.org, linuxppc-dev@ozlabs.org, Jeremy Kerr , Andrew Morton , linuxppc-dev@lists.ozlabs.org, cbe-oss-dev@ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org size_t len cannot be less than 0. Signed-off-by: Roel Kluin Acked-by: Jeremy Kerr --- >>> Or can this test be removed? >> >> I'd prefer just to remove the test. > > Yes, sounds good. If you meant only the left-hand part, here you go: diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 884e8bc..64a4c2d 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c @@ -2494,7 +2494,7 @@ static ssize_t spufs_switch_log_read(struct file *file, char __user *buf, struct spu_context *ctx = SPUFS_I(inode)->i_ctx; int error = 0, cnt = 0; - if (!buf || len < 0) + if (!buf) return -EINVAL; error = spu_acquire(ctx);