From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76E2CC433EF for ; Thu, 23 Jun 2022 09:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KKRLFTfBQP/x2r15/Revs6KWwidcQSPpPWX8v65cCO4=; b=VHoDv6Tp7zjPTR y8NFJy7GOrOiJr1I3/9ZLKH6xW66sD6DJEbLK0pQumva5ZKTowHQbgsdUpSDoPiBZvWYEUnnVwT0b GUykmsKvY1Bfl4YL6if8qagqP2/Qzl7ddq1ty/odaKnJ2sdgHqsri+3GXv3d1AT6+L0ufTi77MV0b cjcXUux2Z6pYh6cuB/UAFPJb3LSO+t0t1KcgQSwoorp2o5LTmfrQgHCIo1BYR4VCExN9M4hufOhT0 eY0QgV9Q3L5zBvqh2v6qGooFMNpPRsDChjPc8J7ipR4pwxKTIVp5bvGi5ncxuET6UnG8Pq9htznAE 6t2RWA46qxksTJ/P71Fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4Ikl-00EEZA-Sy; Thu, 23 Jun 2022 09:03:56 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4Iki-00EEYA-6W; Thu, 23 Jun 2022 09:03:53 +0000 Received: by mail-lj1-x233.google.com with SMTP id by38so681065ljb.10; Thu, 23 Jun 2022 02:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=ozaotd6LY3ERvzpwuGvbQZTaC8kPny1azl5sB1Hldp8=; b=N+E4E6aBHykbEoIC0lGs7IRiK7feaBLf/CkLd78oSXziwtTtGtoy3tXA3mN4u+M1+H 2lEeyKhEQm7uMBzKjVgfV32iv3ycYBLlXefCytlCiYeWvc1vlkkqeVdHyvQa/4I7awPw +yqS6OsEIt1tCt5xFxEtaCt0oLEVSvoZwtAwW4dIcdORniXK5c03omQkgHXW3VVUbG5+ pCxDaxADdI5OOyGHM8VigOdxW8fFm9ClSBdiUkl8+LnNLmV81U1i7QDLpG5qCPGM/ib4 ezVP1RIDjW8Fye2pDE0ph9F+Vj4aLCnvOMeonKSMKU9+nmoEZVsNcW8/ABtqbLZ0wEk1 ujjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=ozaotd6LY3ERvzpwuGvbQZTaC8kPny1azl5sB1Hldp8=; b=wfhxnyRcx5qJ4g9A6blEdLBej2e+WtnPbMxf3N3OGdCKhTNn1ffkTHOUMoHD3FG/N/ gx7DJ1JlYVXS7M7ARfUTFZfyJ3cnekv4dfxhLPu3yeIr6cmU224FdsZNXnBTJ8qTjsPL NxbJFggkEI9mHd7bR36IzS6MKar1JP0yFid3lLIbJXZRoko24NXZwWW+Hv0GuMOxQv2a 5vKsWxrv4Avfzcx339WE3f3QVmvD4avr/i0iYIA61drYjHJDLVolM3xJpDJ82vgL48ud dLycn5c3q3pQv9buo5LjZI9e+cRof2rwEuaMqR8CsxpINJipOME9rmS7StkkD4tJi/tp lhaw== X-Gm-Message-State: AJIora/3Tte64vXqhslkd7ZnXg7mFr7eknokt4RvksnnXAv9sm9zvM2F N7BeOFmgYHOQE6mup5mDOoQ= X-Google-Smtp-Source: AGRyM1vF1zU4Gj87rqZsJvaSlU5/WAIf+VWD8fk9zG8OB0wQ+t7uncoazUPPDPmBI+qN6/ToK7aL7g== X-Received: by 2002:a05:651c:1609:b0:25a:86a5:9eab with SMTP id f9-20020a05651c160900b0025a86a59eabmr4055972ljq.61.1655975028288; Thu, 23 Jun 2022 02:03:48 -0700 (PDT) Received: from [172.16.189.61] ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id s16-20020a05651c201000b0025a73f7aa3bsm1153452ljo.96.2022.06.23.02.03.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jun 2022 02:03:47 -0700 (PDT) Message-ID: <415e6876-9304-9493-369e-d5eca0238bea@gmail.com> Date: Thu, 23 Jun 2022 12:03:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 02/49] regmap-irq: Fix offset/index mismatch in read_sub_irq_data() Content-Language: en-US To: Aidan MacDonald , broonie@kernel.org Cc: agross@kernel.org, bjorn.andersson@linaro.org, srinivas.kandagatla@linaro.org, bgoswami@codeaurora.org, gregkh@linuxfoundation.org, rafael@kernel.org, cw00.choi@samsung.com, krzysztof.kozlowski@linaro.org, b.zolnierkie@samsung.com, myungjoo.ham@samsung.com, michael@walle.cc, linus.walleij@linaro.org, brgl@bgdev.pl, tglx@linutronix.de, maz@kernel.org, lee.jones@linaro.org, mani@kernel.org, cristian.ciocaltea@gmail.com, wens@csie.org, tharvey@gateworks.com, rjones@gateworks.com, mazziesaccount@gmail.com, orsonzhai@gmail.com, baolin.wang7@gmail.com, zhang.lyra@gmail.com, jernej.skrabec@gmail.com, samuel@sholland.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-actions@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, alsa-devel@alsa-project.org References: <20220620200644.1961936-1-aidanmacdonald.0x0@gmail.com> <20220620200644.1961936-3-aidanmacdonald.0x0@gmail.com> From: Matti Vaittinen In-Reply-To: <20220620200644.1961936-3-aidanmacdonald.0x0@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220623_020352_305361_BAAA1E43 X-CRM114-Status: GOOD ( 16.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/20/22 23:05, Aidan MacDonald wrote: > We need to divide the sub-irq status register offset by register > stride to get an index for the status buffer to avoid an out of > bounds write when the register stride is greater than 1. > > Fixes: a2d21848d921 ("regmap: regmap-irq: Add main status register support") > Signed-off-by: Aidan MacDonald > --- > drivers/base/regmap/regmap-irq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c > index 4f785bc7981c..a6db605707b0 100644 > --- a/drivers/base/regmap/regmap-irq.c > +++ b/drivers/base/regmap/regmap-irq.c > @@ -387,6 +387,7 @@ static inline int read_sub_irq_data(struct regmap_irq_chip_data *data, > subreg = &chip->sub_reg_offsets[b]; > for (i = 0; i < subreg->num_regs; i++) { > unsigned int offset = subreg->offset[i]; > + unsigned int index = offset / map->reg_stride; > > if (chip->not_fixed_stride) > ret = regmap_read(map, > @@ -395,7 +396,7 @@ static inline int read_sub_irq_data(struct regmap_irq_chip_data *data, > else > ret = regmap_read(map, > chip->status_base + offset, > - &data->status_buf[offset]); > + &data->status_buf[index]); > > if (ret) > break; Reviewed-by: Matti Vaittinen -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~ Discuss - Estimate - Plan - Report and finally accomplish this: void do_work(int time) __attribute__ ((const)); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel