mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Miquel Sabaté Solà" <mssola@mssola.com>
To: David Sterba <dsterba@suse.cz>
Cc: linux-btrfs@vger.kernel.org,  clm@fb.com,  dsterba@suse.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] btrfs: Prevent open-coded arithmetic in kmalloc
Date: Tue, 23 Sep 2025 08:47:35 +0200	[thread overview]
Message-ID: <87jz1p4qd4.fsf@> (raw)
In-Reply-To: <20250923061344.GT5333@twin.jikos.cz> (David Sterba's message of "Tue, 23 Sep 2025 08:13:44 +0200")

[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]

David Sterba @ 2025-09-23 08:13 +02:

> On Mon, Sep 22, 2025 at 02:47:13PM +0200, Miquel Sabaté Solà wrote:
>> Hello,
>>
>> David Sterba @ 2025-09-22 12:28 +02:
>>
>> > On Fri, Sep 19, 2025 at 04:58:15PM +0200, Miquel Sabaté Solà wrote:
>> >> As pointed out in the documentation, calling 'kmalloc' with open-coded
>> >> arithmetic can lead to unfortunate overflows and this particular way of
>> >> using it has been deprecated. Instead, it's preferred to use
>> >> 'kmalloc_array' in cases where it might apply so an overflow check is
>> >> performed.
>> >
>> > So this is an API cleanup and it makes sense to use the checked
>> > multiplication but it should be also said that this is not fixing any
>> > overflow because in all cases the multipliers are bounded small numbers
>> > derived from number of items in leaves/nodes.
>>
>> Yes, it's just an API cleanup and I don't think it fixes any current bug
>> in the code base. So no need to CC stable or anything like that.
>
> Still the changelog should say explicitly that it's not a bug fix before
> somebody assigns a CVE to it because it mentions overflow.

Got it! I will submit a v2 and make this more explicit.

Thanks,
Miquel

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 897 bytes --]

  reply	other threads:[~2025-09-23  6:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 14:58 [PATCH 0/2] btrfs: Prevent open-coded arithmetic on kmalloc Miquel Sabaté Solà
2025-09-19 14:58 ` [PATCH 1/2] btrfs: Prevent open-coded arithmetic in kmalloc Miquel Sabaté Solà
2025-09-22 10:28   ` David Sterba
2025-09-22 12:47     ` Miquel Sabaté Solà
2025-09-23  6:13       ` David Sterba
2025-09-23  6:47         ` Miquel Sabaté Solà [this message]
2025-09-23  7:00           ` David Sterba
2025-09-23  8:00             ` Miquel Sabaté Solà
2025-09-19 14:58 ` [PATCH 2/2] btrfs: Prefer using the __free cleanup attribute Miquel Sabaté Solà
2025-09-22 10:34 ` [PATCH 0/2] btrfs: Prevent open-coded arithmetic on kmalloc David Sterba
2025-09-22 12:51   ` Miquel Sabaté Solà
2025-09-23  6:11     ` David Sterba
2025-09-23  6:46       ` Miquel Sabaté Solà

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=87jz1p4qd4.fsf@ \
    --to=mssola@mssola.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®