Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6155892ybi; Sun, 21 Jul 2019 10:33:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxb0ODqIosiTUEYk0osvxBPfEVuPTxgPsdunexFivsfyYGjRrCbk+MW4lyyPc5hPZXg44zm X-Received: by 2002:a17:902:744c:: with SMTP id e12mr70470271plt.287.1563730397766; Sun, 21 Jul 2019 10:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563730397; cv=none; d=google.com; s=arc-20160816; b=maq0Q+NJR+oL149Nf41r8/3uzVHk2OUu8mpy2Pj0WyjF2CKyd4RUU6g8IPIx46rYpw nyrvC+NJ3A/aOYCYN7pcN3xv7AZXmmCtmpkwSXvEtSQLPUaiBk/jlt3nZz+bAmzKaw/x YJPMKzDmydsD3qg6EHhJi0PezPQBQL8t5aurd8zLKlRwcWYJmpLSy26iJWz0f2xXGnIt 2EyDcusPHt+RYgJAsn3EVqL24bBIOrF7QRf+7vaZ9WqispOWIMuStSotDysFLRwSVy7e w/kugd48soMlL1ZjR4NJLmYT7pWCUbhKqsyN4ibKlReu2eiGT5hs0ZGqcopAxy9LOvzo Iaig== 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 :dkim-signature; bh=rA5NPsvEnY7TXMusWL6JbZYLBMPf62TUq0LzAMve1LQ=; b=cpClC9c9R8rpAfVOeHRIiAb6h73KSMu3ON+axr0/Cn4pNm0szAR/1UJEdLOgX63/W5 KLIHoNAxKT9UQN+U/AQMXqKbyIcVgxyWUWU7eOOsM6tZ/tTzwdZKWtMhYa27IBszljE4 G/nNp7Szv7Ces1mcvkHNIl19yriYhujxNkgmt/cohfIoK+6YdsJo7np99qE057mMXP5o sfbHs9ckaKH/SjKpmBN6BRmDmvHCMLcVqxuoPQOPdgD9489ktiMi/THRTPDEkzv7+ep1 oguCo5BYjNYFpnLsek6yJTLthOMHjqLcFv6aGBhqSJgQ98KGdanweK0OW5es1Gp7C+e7 EGZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=znv4LoeG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 78si6675055pfz.268.2019.07.21.10.33.01; Sun, 21 Jul 2019 10:33:17 -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; dkim=pass header.i=@kernel.org header.s=default header.b=znv4LoeG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726905AbfGUR1R (ORCPT + 99 others); Sun, 21 Jul 2019 13:27:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:52082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbfGUR1R (ORCPT ); Sun, 21 Jul 2019 13:27:17 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 6BB4320578; Sun, 21 Jul 2019 17:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563730036; bh=+UiPDYtkHRTWbty+sAOnSmMguCB2WGQPTjyFBuojhMI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=znv4LoeGaAPaZvSU/lq+SGhO1S6KvgslHjEJ43whRA6oxj3a+m3Bf3YSGiypArGZE Cakp7ecFMYSAcxJ9bIZ/KBJOxdlDvLz/Q0R5mOl2KEWjfxVVhQz3vP0OjS23O6U+bx Pngd/ZvVXg4dnwJZ0WlajuXNbowfi6mF1WpZceAA= Date: Sun, 21 Jul 2019 18:27:02 +0100 From: Jonathan Cameron To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Young Xiao <92siuyang@gmail.com>, Alexandru Ardelean , Jonathan Cameron , linux-iio@vger.kernel.org Subject: Re: [PATCH AUTOSEL 4.14 19/60] iio:core: Fix bug in length of event info_mask and catch unhandled bits set in masks. Message-ID: <20190721182643.3fd0515b@archlinux> In-Reply-To: <20190719041109.18262-19-sashal@kernel.org> References: <20190719041109.18262-1-sashal@kernel.org> <20190719041109.18262-19-sashal@kernel.org> X-Mailer: Claws Mail 3.17.3 (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, 19 Jul 2019 00:10:28 -0400 Sasha Levin wrote: > From: Young Xiao <92siuyang@gmail.com> > > [ Upstream commit 936d3e536dcf88ce80d27bdb637009b13dba6d8c ] > > The incorrect limit for the for_each_set_bit loop was noticed whilst fixing > this other case. Note that as we only have 3 possible entries a the moment > and the value was set to 4, the bug would not have any effect currently. > It will bite fairly soon though, so best fix it now. > > See commit ef4b4856593f ("iio:core: Fix bug in length of event info_mask and > catch unhandled bits set in masks.") for details. > > Signed-off-by: Young Xiao <92siuyang@gmail.com> > Reviewed-by: Alexandru Ardelean > Signed-off-by: Jonathan Cameron > Signed-off-by: Sasha Levin As the patch states, this bug doesn't have any impact. It would only be triggered by a buggy driver setting a bit in that mask that makes no sense. So it's good to fix in upstream, but debatable if it's worth porting back to stable. I don't have a strong opinion on this one and again, it should do no harm. Jonathan > --- > drivers/iio/industrialio-core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c > index 97b7266ee0ff..b0f952984983 100644 > --- a/drivers/iio/industrialio-core.c > +++ b/drivers/iio/industrialio-core.c > @@ -1116,6 +1116,8 @@ static int iio_device_add_info_mask_type_avail(struct iio_dev *indio_dev, > char *avail_postfix; > > for_each_set_bit(i, infomask, sizeof(*infomask) * 8) { > + if (i >= ARRAY_SIZE(iio_chan_info_postfix)) > + return -EINVAL; > avail_postfix = kasprintf(GFP_KERNEL, > "%s_available", > iio_chan_info_postfix[i]);