From patchwork Sun Jul 26 21:18:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 500158 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C01B7140319 for ; Mon, 27 Jul 2015 07:27:09 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 9DB691A0C71 for ; Mon, 27 Jul 2015 07:27:09 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail.mleia.com (li271-223.members.linode.com [178.79.152.223]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id CF5C91A0709 for ; Mon, 27 Jul 2015 07:26:02 +1000 (AEST) Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id AEB6B10120D; Sun, 26 Jul 2015 22:24:34 +0100 (BST) Received: from localhost.localdomain (a91-152-106-128.elisa-laajakaista.fi [91.152.106.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mleia.com (Postfix) with ESMTPSA id 53A0D10120C; Sun, 26 Jul 2015 22:24:34 +0100 (BST) From: Vladimir Zapolskiy To: Greg Kroah-Hartman Subject: [PATCH 1/8] misc: cxl: clean up afu_read_config() Date: Mon, 27 Jul 2015 00:18:46 +0300 Message-Id: <1437945533-27996-1-git-send-email-vz@mleia.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1437945502-27944-1-git-send-email-vz@mleia.com> References: <1437945502-27944-1-git-send-email-vz@mleia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20150726_222434_736894_93F612E5 X-CRM114-Status: GOOD ( 14.49 ) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Neuling , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Ian Munsie MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The sanity checks for overflow are not needed, because this is done on caller side in fs/sysfs/file.c Signed-off-by: Vladimir Zapolskiy Cc: linuxppc-dev@lists.ozlabs.org Cc: Ian Munsie Cc: Michael Neuling Reviewed-by: Daniel Axtens Acked-by: Michael Neuling --- drivers/misc/cxl/sysfs.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c index 31f38bc..87cd747 100644 --- a/drivers/misc/cxl/sysfs.c +++ b/drivers/misc/cxl/sysfs.c @@ -443,12 +443,7 @@ static ssize_t afu_read_config(struct file *filp, struct kobject *kobj, struct afu_config_record *cr = to_cr(kobj); struct cxl_afu *afu = to_cxl_afu(container_of(kobj->parent, struct device, kobj)); - u64 i, j, val, size = afu->crs_len; - - if (off > size) - return 0; - if (off + count > size) - count = size - off; + u64 i, j, val; for (i = 0; i < count;) { val = cxl_afu_cr_read64(afu, cr->cr, off & ~0x7);