From patchwork Tue Jan 12 12:46:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 59612 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2716264lbb; Tue, 12 Jan 2016 04:49:28 -0800 (PST) X-Received: by 10.98.0.150 with SMTP id 144mr7810036pfa.139.1452602968046; Tue, 12 Jan 2016 04:49:28 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id w79si19207943pfi.99.2016.01.12.04.49.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jan 2016 04:49:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aIyMn-0002X7-NJ; Tue, 12 Jan 2016 12:48:05 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aIyMb-0002Qp-0K for linux-arm-kernel@lists.infradead.org; Tue, 12 Jan 2016 12:47:53 +0000 Received: by mail-wm0-x231.google.com with SMTP id b14so318276923wmb.1 for ; Tue, 12 Jan 2016 04:47:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6mNeXzkaqz201OSlTJ3Re5SkEuYRaEYyYUTtgfdeHks=; b=DeZyNC5anLsyjHZDQ6v4Q+3fwbTj4KhVeLicAPur3phbHicRb4aGohsQH63OuYGFHi 7LM8/51Z5+Mkz8aO4xIE9KN9kMHwrOkoJNZF1qB6wGg9TS+kiMjNp/bQiUbnrJWRu0tK yGdx9y4IYkjEeXAsBAqfO9EsWUfmVq2+FF+U0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6mNeXzkaqz201OSlTJ3Re5SkEuYRaEYyYUTtgfdeHks=; b=GskmKV+8VeBtEfYQVzI8MBHpziOuBdG4OtWxo6bVgRy/rdg70K8SK1hZ3YSYUAoCZ5 QufiNvLw7I9KI6/StrObEL2dttPj++y/gkTgs+Kun0eL8GKuS9i1q42T7VSZkELTP5/j iHLf3ysV1uqjLheFPK5NSHh06DgffO/a5rB0s6wgQEi6kQC9eD7IoO75h+n+Zz6POVUd 9eWHHmSYR8klCz/IYS+OD2yBOf6ryMP/BHU8Aux5NyUZe70WYdNupUkGw9Maykgr34dw 5JqkCQmVooEIyVn9EPRGSq50aiW+OMF/D1T/ZJnMivm6TziUmZncjolA2JNh7DyNF+nL ygTA== X-Gm-Message-State: ALoCoQnbqOIGCjE5dAKDr9AHajunLotEkyhZFkYiQj12RgFB/2PEat2ZRSullvSb49q6BMEDa6CSKWNm6VHFItqbT7jA0IG47w== X-Received: by 10.194.184.210 with SMTP id ew18mr124218805wjc.79.1452602851496; Tue, 12 Jan 2016 04:47:31 -0800 (PST) Received: from localhost.localdomain ([217.46.108.250]) by smtp.gmail.com with ESMTPSA id uo9sm30240142wjc.49.2016.01.12.04.47.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jan 2016 04:47:30 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/7] remoteproc: debugfs: Check of invalid 'count' value Date: Tue, 12 Jan 2016 12:46:15 +0000 Message-Id: <1452602781-22424-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452602781-22424-1-git-send-email-lee.jones@linaro.org> References: <1452602781-22424-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160112_044753_216560_5CD257E4 X-CRM114-Status: GOOD ( 12.62 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:231 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ohad@wizery.com, devicetree@vger.kernel.org, f.fainelli@gmail.com, kernel@stlinux.com, Nathan_Lynch@mentor.com, Lee Jones , ludovic.barre@st.com, maxime.coquelin@st.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org If 'count' value is invalid, return early with an error. Signed-off-by: Lee Jones --- drivers/remoteproc/remoteproc_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index 9d30809..f63464c 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c @@ -156,8 +156,8 @@ rproc_recovery_write(struct file *filp, const char __user *user_buf, char buf[10]; int ret; - if (count > sizeof(buf)) - return count; + if (count > sizeof(buf) || count <= 0) + return -EINVAL; ret = copy_from_user(buf, user_buf, count); if (ret)