All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alyssa Rosenzweig <alyssa@collabora.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: tomeu.vizoso@collabora.com, dri-devel@lists.freedesktop.org,
	steven.price@arm.com, alyssa.rosenzweig@collabora.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] drm/panfrost: Update io-pgtable API
Date: Wed, 31 Aug 2022 08:49:16 -0400	[thread overview]
Message-ID: <Yw9YzJD7S9R+cRwp@maud> (raw)
In-Reply-To: <bbff1b5b-020c-7f61-1530-20fb0d6a1ef9@arm.com>

On Tue, Aug 23, 2022 at 11:42:33AM +0100, Robin Murphy wrote:
> On 2022-08-23 03:51, Alyssa Rosenzweig wrote:
> > > -static size_t get_pgsize(u64 addr, size_t size)
> > > +static size_t get_pgsize(u64 addr, size_t size, size_t *count)
> > >   {
> > > -	if (addr & (SZ_2M - 1) || size < SZ_2M)
> > > -		return SZ_4K;
> > > +	size_t blk_offset = -addr % SZ_2M;
> > 
> > addr is unsigned. if this is correct, it's magic.
> 
> Eh, it's just well-defined unsigned integer overflow. Take "SZ_2M - (addr %
> SZ_2M)", realise the first term can be anything that's zero modulo SZ_2M,
> including zero, then also that the operations can be done in either order to
> give the same result, and there you go.

Shrug. It still seems voodoo to me but if this is normal kernel style
I'm not going to complain, Acked-by for the patch regardless.

WARNING: multiple messages have this Message-ID (diff)
From: Alyssa Rosenzweig <alyssa@collabora.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: robh@kernel.org, tomeu.vizoso@collabora.com,
	steven.price@arm.com, alyssa.rosenzweig@collabora.com,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] drm/panfrost: Update io-pgtable API
Date: Wed, 31 Aug 2022 08:49:16 -0400	[thread overview]
Message-ID: <Yw9YzJD7S9R+cRwp@maud> (raw)
In-Reply-To: <bbff1b5b-020c-7f61-1530-20fb0d6a1ef9@arm.com>

On Tue, Aug 23, 2022 at 11:42:33AM +0100, Robin Murphy wrote:
> On 2022-08-23 03:51, Alyssa Rosenzweig wrote:
> > > -static size_t get_pgsize(u64 addr, size_t size)
> > > +static size_t get_pgsize(u64 addr, size_t size, size_t *count)
> > >   {
> > > -	if (addr & (SZ_2M - 1) || size < SZ_2M)
> > > -		return SZ_4K;
> > > +	size_t blk_offset = -addr % SZ_2M;
> > 
> > addr is unsigned. if this is correct, it's magic.
> 
> Eh, it's just well-defined unsigned integer overflow. Take "SZ_2M - (addr %
> SZ_2M)", realise the first term can be anything that's zero modulo SZ_2M,
> including zero, then also that the operations can be done in either order to
> give the same result, and there you go.

Shrug. It still seems voodoo to me but if this is normal kernel style
I'm not going to complain, Acked-by for the patch regardless.

_______________________________________________
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-31 12:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22 22:01 [PATCH] drm/panfrost: Update io-pgtable API Robin Murphy
2022-08-22 22:01 ` Robin Murphy
2022-08-23  2:51 ` Alyssa Rosenzweig
2022-08-23  2:51   ` Alyssa Rosenzweig
2022-08-23 10:42   ` Robin Murphy
2022-08-23 10:42     ` Robin Murphy
2022-08-31 12:49     ` Alyssa Rosenzweig [this message]
2022-08-31 12:49       ` Alyssa Rosenzweig
2022-09-01 10:17 ` Steven Price
2022-09-01 10:17   ` Steven Price
2022-11-04 20:11 ` Dmitry Osipenko
2022-11-04 20:11   ` Dmitry Osipenko
2022-11-04 20:37   ` Robin Murphy
2022-11-04 20:37     ` Robin Murphy
2022-11-04 20:48     ` Dmitry Osipenko
2022-11-04 20:48       ` Dmitry Osipenko
2022-11-07 16:50       ` Robin Murphy
2022-11-07 16:50         ` Robin Murphy
2022-11-08 14:11         ` Dmitry Osipenko
2022-11-08 14:11           ` Dmitry Osipenko

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=Yw9YzJD7S9R+cRwp@maud \
    --to=alyssa@collabora.com \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=steven.price@arm.com \
    --cc=tomeu.vizoso@collabora.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.