All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lee Jones <lee@kernel.org>, ChiYuan Huang <cy_huang@richtek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	ChiaEn Wu <chiaen_wu@richtek.com>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>,
	kernel-janitors <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] mfd: mt6370: add bounds checking to regmap_read/write functions
Date: Mon, 22 Aug 2022 15:57:05 +0300	[thread overview]
Message-ID: <20220822125705.GD2695@kadam> (raw)
In-Reply-To: <CAHp75VcotcJzqc4iSwNTKcvF3vAYz6VUuMrsj7LF6mi6Xu8D=Q@mail.gmail.com>

On Fri, Aug 19, 2022 at 09:27:13AM +0300, Andy Shevchenko wrote:
> On Fri, Aug 19, 2022 at 8:25 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > It looks like there are a potential out of bounds accesses in the
> > read/write() functions.  Also can "len" be negative?  Let's check for
> > that too.
> 
> ...
> 
> > Fixes: ab9905c5e38e ("mfd: mt6370: Add MediaTek MT6370 support")
> 
> > From static analysis.  This code is obviously harmless however it may
> > not be required.  The regmap range checking is slightly complicated and
> > I haven't remembered where all it's done.
> 
> Exactement! I do not think this Fixes anything, I believe you are
> adding a dead code. So, can you do deeper analysis?

I spent a long time looking at this code before I sent it and I've
spent a long time looking at it today.

Smatch said that these values come from the user, but now it seems
less clear to me and I have rebuilt the DB so I don't have the same
information I was looking at earlier.

So I can't see if these come from the user but neither can I find any
bounds checking.

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lee Jones <lee@kernel.org>, ChiYuan Huang <cy_huang@richtek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	ChiaEn Wu <chiaen_wu@richtek.com>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	kernel-janitors <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] mfd: mt6370: add bounds checking to regmap_read/write functions
Date: Mon, 22 Aug 2022 15:57:05 +0300	[thread overview]
Message-ID: <20220822125705.GD2695@kadam> (raw)
In-Reply-To: <CAHp75VcotcJzqc4iSwNTKcvF3vAYz6VUuMrsj7LF6mi6Xu8D=Q@mail.gmail.com>

On Fri, Aug 19, 2022 at 09:27:13AM +0300, Andy Shevchenko wrote:
> On Fri, Aug 19, 2022 at 8:25 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > It looks like there are a potential out of bounds accesses in the
> > read/write() functions.  Also can "len" be negative?  Let's check for
> > that too.
> 
> ...
> 
> > Fixes: ab9905c5e38e ("mfd: mt6370: Add MediaTek MT6370 support")
> 
> > From static analysis.  This code is obviously harmless however it may
> > not be required.  The regmap range checking is slightly complicated and
> > I haven't remembered where all it's done.
> 
> Exactement! I do not think this Fixes anything, I believe you are
> adding a dead code. So, can you do deeper analysis?

I spent a long time looking at this code before I sent it and I've
spent a long time looking at it today.

Smatch said that these values come from the user, but now it seems
less clear to me and I have rebuilt the DB so I don't have the same
information I was looking at earlier.

So I can't see if these come from the user but neither can I find any
bounds checking.

regards,
dan carpenter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-08-22 12:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19  5:25 [PATCH] mfd: mt6370: add bounds checking to regmap_read/write functions Dan Carpenter
2022-08-19  5:25 ` Dan Carpenter
2022-08-19  6:27 ` Andy Shevchenko
2022-08-19  6:27   ` Andy Shevchenko
2022-08-22 12:57   ` Dan Carpenter [this message]
2022-08-22 12:57     ` Dan Carpenter
2022-09-08  6:57     ` Lee Jones
2022-09-08  6:57       ` Lee Jones
2022-09-08  7:54       ` Andy Shevchenko
2022-09-08  7:54         ` Andy Shevchenko
2022-09-08 10:49       ` Dan Carpenter
2022-09-08 10:49         ` Dan Carpenter
2022-09-09  6:59         ` Lee Jones
2022-09-09  6:59           ` Lee Jones
2022-09-14  1:33           ` ChiYuan Huang
2022-09-14  1:33             ` ChiYuan Huang
2022-08-23 22:09 ` Andy Shevchenko
2022-08-23 22:09   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220822125705.GD2695@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=chiaen_wu@richtek.com \
    --cc=cy_huang@richtek.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.