linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Carsten Haitzler <carsten.haitzler@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Subject: Re: [PATCH] drm/komeda: use bitmap API to convert U32 to bitmap
Date: Mon, 28 Dec 2020 12:10:46 -0800	[thread overview]
Message-ID: <CAAH8bW9UvDAB4NSQB6CuhBU6D=R6Ex6=5V=Ld74hYGK474_Trw@mail.gmail.com> (raw)
In-Reply-To: <20201228195016.GD4077@smile.fi.intel.com>

On Mon, Dec 28, 2020 at 11:49 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Dec 28, 2020 at 11:43:43AM -0800, Yury Norov wrote:
> > The commit be3e477effba636ad25 ("drm/komeda: Fix bit
> > check to import to value of proper type") fixes possible
> > out-of-bound issue related to find_first_bit() usage, but
> > does not address the endianness problem.
>
> Hmm... Can you elaborate?
>
> ...
>
> >                                   u32 comp_mask)
>
> > -     unsigned long comp_mask_local = (unsigned long)comp_mask;
>
> Here we convert u32 to unsigned long (LSB is kept LSB since it happens in
> native endianess).
>
> > -     id = find_first_bit(&comp_mask_local, 32);
>
> Here it takes an address to unsigned long and tries only lower 32 bits.
>
> Are you telling that find_first_bit() has an issue?

It seems you're right, there's no issue with endianness in existing code.
In fact, the line

> > -     unsigned long comp_mask_local = (unsigned long)comp_mask;

is an opencoded version of bitmap_from_arr32(dst, src, 32).

Maybe it would be better to use the bitmap API here, but existing code is
correct. Sorry for the noise.

Yury

  reply	other threads:[~2020-12-28 23:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-28 19:43 [PATCH] drm/komeda: use bitmap API to convert U32 to bitmap Yury Norov
2020-12-28 19:50 ` Andy Shevchenko
2020-12-28 20:10   ` Yury Norov [this message]
2020-12-29 12:22     ` Carsten Haitzler
2020-12-29 13:50       ` Andy Shevchenko
2020-12-29 18:09         ` Yury Norov
2020-12-29 18:27           ` Yury Norov

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='CAAH8bW9UvDAB4NSQB6CuhBU6D=R6Ex6=5V=Ld74hYGK474_Trw@mail.gmail.com' \
    --to=yury.norov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=carsten.haitzler@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=rasmus.villemoes@prevas.dk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).