Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755581AbbGZV2o (ORCPT ); Sun, 26 Jul 2015 17:28:44 -0400 Received: from li271-223.members.linode.com ([178.79.152.223]:55692 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755300AbbGZV0D (ORCPT ); Sun, 26 Jul 2015 17:26:03 -0400 From: Vladimir Zapolskiy To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Ian Munsie , Michael Neuling 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 ) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1213 Lines: 37 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 --- 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); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/