From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-sh@vger.kernel.org
Subject: Re: [PATCH RESEND] sh: sq: Use the bitmap API when applicable
Date: Tue, 18 Apr 2023 20:05:54 +0200 [thread overview]
Message-ID: <d2b2baca-589d-83ef-04b0-0f64b18f9d95@wanadoo.fr> (raw)
In-Reply-To: <CAMuHMdWz7YJ4ifkxU2GGdoj46fTsjS5WE66R0YzvOYr1ZKY=4w@mail.gmail.com>
Le 18/04/2023 à 09:14, Geert Uytterhoeven a écrit :
>
> Nice catch!
>
> Looking more deeply at the code, the intention is to allocate a bitmap
> with nr_pages bits, so the code fater Christophe's patch is correct.
> However, the old code is indeed wrong:
>
> (nr_pages + (BITS_PER_LONG - 1)) / BITS_PER_LONG
>
> The aim is to calculate the size in bytes, rounded up to an integral
> number of longs, but it lacks a final multiplication by BITS_PER_BYTE,
> so it's off by a factor of 4.
>
> Fixes: d7c30c682a278abe ("sh: Store Queue API rework.")
>
> As we didn't have bitmap_zalloc() until commit c42b65e363ce97a8
> ("bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()")
> in v4.19, it would be good to fix the bug first in a separate patch,
> not using
>
> BTW, interesting how this got missed when fixing the other out-of-range
> bug in commit 9f650cf2b811cfb6 ("sh: Fix store queue bitmap end.",
> s/marc.theaimsgroup.com/marc.info/ when following the link).
So, this means that this got unnoticed for 16 years?
Waouh!
I would never have thought that a "trivial" clean-up that I took time to
repost could trigger such a thing!
Again.
Waouh!
Maybe, 0x04000000 is way to big?
Anyone knows where this value comes from?
Could there have been some memory corruption in real world application?
CJ
>
> Gr{oetje,eeting}s,
>
> Geert
>
next prev parent reply other threads:[~2023-04-18 18:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-16 19:05 Christophe JAILLET
2023-04-16 19:33 ` John Paul Adrian Glaubitz
2023-04-17 6:51 ` Geert Uytterhoeven
2023-04-18 2:13 ` Rob Landley
2023-04-18 6:36 ` John Paul Adrian Glaubitz
2023-04-18 7:14 ` Geert Uytterhoeven
2023-04-18 7:18 ` John Paul Adrian Glaubitz
2023-04-18 18:05 ` Christophe JAILLET [this message]
2023-04-19 21:25 ` John Paul Adrian Glaubitz
2023-04-18 7:30 ` Dan Carpenter
2023-04-18 9:39 ` Dan Carpenter
2023-04-18 9:42 ` John Paul Adrian Glaubitz
2023-04-19 4:48 ` Dan Carpenter
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=d2b2baca-589d-83ef-04b0-0f64b18f9d95@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=dalias@libc.org \
--cc=geert@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=ysato@users.sourceforge.jp \
/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
all inboxes | Powered by JetHome®