From patchwork Mon Oct 12 13:12:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 35759 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 B7F19B7DCF for ; Tue, 13 Oct 2009 00:03:24 +1100 (EST) Received: by ozlabs.org (Postfix) id B7146B7B69; Tue, 13 Oct 2009 00:03:18 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26]) by ozlabs.org (Postfix) with ESMTP id 38FA6B70B3; Tue, 13 Oct 2009 00:03:16 +1100 (EST) Received: by ey-out-2122.google.com with SMTP id 4so2707126eyf.33 for ; Mon, 12 Oct 2009 06:03:14 -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:subject:content-type :content-transfer-encoding; bh=BFNsTuVAYSsSGp12aF37uOWZ45qI5n7bm8lzI17UlKw=; b=bgRM+HAPjQSud5tb4m9J3bmRcDdNzrbu0l6E2QpCEAudgmqJipPL9hIqM1qe0FlO0j JeDVJRxp74+Q826IAUhJOzjWMIY3Kcs+RrU+wdp/QhPyTcGayhpJhAZorHCKJonAAt0X QzmbvFAJSVH4J9rJX4j8D61U73O2bJws8iC9U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=VKnJtYERTYphaYjBC9tYePxGCUq4WRTJu1UTydLllTXerwo+jSArlb/Ehg722/DwpR nUddP8j1YX79Agxlch0UPkadZrFVDCfC8+JdNf2UIu9K+J3F/4l22VqGE+HwW+5e+SQn jnHu8B062chOAdAENyKDA6m0Nj4cMbX/Uvbyk= Received: by 10.210.155.2 with SMTP id c2mr4013610ebe.23.1255352594540; Mon, 12 Oct 2009 06:03:14 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 7sm259541eyb.8.2009.10.12.06.03.13 (version=SSLv3 cipher=RC4-MD5); Mon, 12 Oct 2009 06:03:13 -0700 (PDT) Message-ID: <4AD32B3F.9060804@gmail.com> Date: Mon, 12 Oct 2009 15:12:31 +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: Jeremy Kerr , linuxppc-dev@ozlabs.org, cbe-oss-dev@ozlabs.org, Andrew Morton Subject: [PATCH] spufs: Fix test in spufs_switch_log_read() 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 --- Or can this test be removed? diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 884e8bc..d4f304f 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 || (ssize_t)len < 0) return -EINVAL; error = spu_acquire(ctx);