Received: by 10.192.165.148 with SMTP id m20csp1917585imm; Sat, 28 Apr 2018 08:09:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo+DPy8iXWWU+nHBFNYiptBxLYMqB85KVXEaMr8WjjAMQsApQRQ2EOGQ0DqStFKesJstkmH X-Received: by 10.98.12.202 with SMTP id 71mr6041740pfm.61.1524928184805; Sat, 28 Apr 2018 08:09:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524928184; cv=none; d=google.com; s=arc-20160816; b=Ods9z7gyYPuOUTRwDA4JMJFAnEdITlZMuIr9AhgQAGuwdJpqQtkpjV5zuCT3mdQN5O rHnVVA01AvDnS0UQ+6ZZ3hgryGrOvUDbRJCbJH7Q6pVI8ckOk1MibyOHrFitdbBhkg61 w07zWRaliT71VBJv1pghWqtDLTHKm01jwl88ASesw7MKy+CIn1PMVaUL61z6ML7iG1iN AnZc+52BB6qfHamHQ44Zyg8ItPn5dHV1gDlEJAd+kJ433DDDMnYdZEtm7NcOaQiM+tme 4Pf7n0hS0/DOed1JjuVtp/UvwGO+YQp0ACcHlsPzhSwwhk5F+OGpMeuf6n7vqmVq1JK3 NgOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=RoxfT3tdn906R8yTTXJFdUIb0TfoCCNpQ6iF2qbr4MQ=; b=ch6drooTuEJCRI4KUUEDo898bIZnGjLGMKso3d4nwqdtNf0zDgpd85p/x2EQ0pGaO5 O8ZI3ZouUMKDLyiq+Shpzys5SObnEZHkaTgWcMLtI8AiTfDs8bWtOCBR30ODKAMFzyh/ 19CGd+EoAUL6JpDy6KrGre5K15CUD55C50eA2I88YR9GBUX8LbVEtH4jRHzvX2A3LwMy mfvElrXuxPBI5+36ok9OvqZQkILukuqteHLRIzOaoRd65wgllqrkCQGIVkeNyPUzpny6 ZRyA4YbXaOJK8MYI34e1qBnxxYhGixfCJgURJThRrdLRRa5k8uGEtwlZF5r5Zz1unxbs IPag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u81si3697320pfg.289.2018.04.28.08.09.30; Sat, 28 Apr 2018 08:09:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757613AbeD1PIQ (ORCPT + 99 others); Sat, 28 Apr 2018 11:08:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:33362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751354AbeD1PIM (ORCPT ); Sat, 28 Apr 2018 11:08:12 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B63121DEF; Sat, 28 Apr 2018 15:08:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B63121DEF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Sat, 28 Apr 2018 16:07:06 +0100 From: Jonathan Cameron To: Fabrice Gasnier Cc: , , , , , , , , , Subject: Re: [PATCH 6/7] iio: adc: stm32-dfsdm: add check on max filter id Message-ID: <20180428160706.2aafad5b@archlinux> In-Reply-To: <1519390261-25453-7-git-send-email-fabrice.gasnier@st.com> References: <1519390261-25453-1-git-send-email-fabrice.gasnier@st.com> <1519390261-25453-7-git-send-email-fabrice.gasnier@st.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 23 Feb 2018 13:51:00 +0100 Fabrice Gasnier wrote: > reg property should be checked against number of available filters. > BTW, dfsdm->num_fls wasn't used. But it can be used for this purpose. > This prevents using data out of allocated dfsdm->fl_list array. > > Signed-off-by: Fabrice Gasnier Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > drivers/iio/adc/stm32-dfsdm-adc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c > index 57bcb45..1b78bec 100644 > --- a/drivers/iio/adc/stm32-dfsdm-adc.c > +++ b/drivers/iio/adc/stm32-dfsdm-adc.c > @@ -1111,8 +1111,8 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, adc); > > ret = of_property_read_u32(dev->of_node, "reg", &adc->fl_id); > - if (ret != 0) { > - dev_err(dev, "Missing reg property\n"); > + if (ret != 0 || adc->fl_id >= adc->dfsdm->num_fls) { > + dev_err(dev, "Missing or bad reg property\n"); > return -EINVAL; > } >