Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751682AbbHEHsV (ORCPT ); Wed, 5 Aug 2015 03:48:21 -0400 Received: from ozlabs.org ([103.22.144.67]:46812 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbbHEHsC convert rfc822-to-8bit (ORCPT ); Wed, 5 Aug 2015 03:48:02 -0400 Message-ID: <1438760880.20978.2.camel@neuling.org> Subject: Re: [PATCH 1/8] misc: cxl: clean up afu_read_config() From: Michael Neuling To: Vladimir Zapolskiy Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Ian Munsie , Michael Ellerman Date: Wed, 05 Aug 2015 17:48:00 +1000 In-Reply-To: <1437945533-27996-1-git-send-email-vz@mleia.com> References: <1437945502-27944-1-git-send-email-vz@mleia.com> <1437945533-27996-1-git-send-email-vz@mleia.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1370 Lines: 39 On Mon, 2015-07-27 at 00:18 +0300, Vladimir Zapolskiy wrote: > 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 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); -- 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/