All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Baruch Siach <baruch@tkos.co.il>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Martyn Welch <martyn.welch@collabora.com>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Nam Cao <namcao@linutronix.de>,
	Sughosh Ganu <sughosh.ganu@linaro.org>
Subject: Re: [PATCH 01/17] fs: boot: Update fs_read_alloc() to use abuf
Date: Tue, 1 Apr 2025 10:50:37 -0600	[thread overview]
Message-ID: <20250401165037.GI5495@bill-the-cat> (raw)
In-Reply-To: <CAFLszTipRBusG+oxusk5rzGJO1bdorE5uBhpEMfGGpjfH6yywg@mail.gmail.com>

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

On Wed, Apr 02, 2025 at 04:46:23AM +1300, Simon Glass wrote:
> Hi Tom,
> 
> On Tue, 1 Apr 2025 at 06:42, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Wed, Mar 19, 2025 at 03:37:55PM +0100, Simon Glass wrote:
> >
> > > Using an abuf for this function simplifies returning the size and also
> > > makes it easier to free memory afterwards. Update the API and callers.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > >
> > >  boot/bootmeth-uclass.c | 19 ++++++++++---------
> > >  fs/fs.c                | 25 +++++++++++--------------
> > >  include/fs.h           |  8 +++++---
> > >  3 files changed, 26 insertions(+), 26 deletions(-)
> >
> > So we grow platforms by ~200 bytes:
> >             sama7g54_curiosity_nandflash: all +204 text +204
> >                u-boot: add: 6/0, grow: 2/0 bytes: 204/0 (204)
> >                  function                                   old     new   delta
> >                  abuf_realloc                                 -      76     +76
> >                  abuf_uninit_move                             -      42     +42
> >                  memdup                                       -      28     +28
> >                  abuf_uninit                                  -      24     +24
> >                  fs_read_alloc                               96     106     +10
> >                  fs_load_alloc                              114     124     +10
> >                  abuf_init                                    -      10     +10
> >                  abuf_addr                                    -       4      +4
> >
> > To move away from standard buffer usage and unwinding to move to
> > something homegrown instead. I am not a fan of growing using abuf here.
> > When it was introduced in:
> >
> > commit 67bc59df05331eaac56cd0a00219d1386130aee2
> > Author: Simon Glass <sjg@chromium.org>
> > Date:   Sat Sep 25 07:03:07 2021 -0600
> >
> >     Add support for an owned buffer
> >
> > It sounded like something for some special cases. Not something to be
> > used everywhere to be different.
> 
> From what I can tell this is a one-off hit that I believe is worth
> taking at some point. However I haven't seen a code-size reduction
> yet, so I can understand your reluctance.

I'm not sure why it's worth taking. I'm not sure that abuf is worth
pushing in to every place we allocate a buffer for strings. If someone
wants to put in effort to make our handling of strings better/safer/more
secure we should look to all of the work Kees Cook (et al) did in the
kernel and borrow that, not invent something new and U-Boot specific.

-- 
Tom

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

  reply	other threads:[~2025-04-01 16:50 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19 14:37 [PATCH 00/17] bootstd: Useability improvements Simon Glass
2025-03-19 14:37 ` [PATCH 01/17] fs: boot: Update fs_read_alloc() to use abuf Simon Glass
2025-03-31 17:42   ` Tom Rini
2025-04-01 15:46     ` Simon Glass
2025-04-01 16:50       ` Tom Rini [this message]
2025-05-01 12:07         ` Simon Glass
2025-03-19 14:37 ` [PATCH 02/17] fs: boot: Update fs_load_alloc() " Simon Glass
2025-03-19 14:37 ` [PATCH 03/17] fs: boot: Update bootmeth_alloc_other() " Simon Glass
2025-03-19 14:37 ` [PATCH 04/17] bootstd: Add more debugging to bootmeth_efi Simon Glass
2025-03-19 14:37 ` [PATCH 05/17] bootstd: Add more debugging to bootmeth_extlinux Simon Glass
2025-03-19 14:38 ` [PATCH 06/17] bootstd: Try all bootmeths on the final partition Simon Glass
2025-03-31 17:41   ` Tom Rini
2025-03-19 14:38 ` [PATCH 07/17] bootstd: Fully complete iteration of a uclass Simon Glass
2025-03-31 17:41   ` Tom Rini
2025-03-19 14:38 ` [PATCH 08/17] test/py: Split out core of Fedora image into a new function Simon Glass
2025-03-19 14:38 ` [PATCH 09/17] test/py: Add a test image for Ubuntu Simon Glass
2025-03-19 14:52   ` Tom Rini
2025-03-19 15:04     ` Simon Glass
2025-03-19 15:35       ` Tom Rini
2025-03-20  3:41         ` Simon Glass
2025-03-30 14:45           ` Tom Rini
2025-04-01 15:49             ` Simon Glass
2025-04-01 16:48               ` Tom Rini
2025-04-01 17:55                 ` Simon Glass
2025-04-11 19:13                   ` Tom Rini
2025-04-12 12:45                     ` Simon Glass
2025-04-12 18:41                       ` Tom Rini
2025-03-19 14:38 ` [PATCH 10/17] usb: Use more useful names for block devices Simon Glass
2025-03-19 14:38 ` [PATCH 11/17] sandbox: Use a unique name for each USB controller Simon Glass
2025-03-19 14:38 ` [PATCH 12/17] bootstd: Tweak scanning with labels Simon Glass
2025-03-19 14:38 ` [PATCH 13/17] bootstd: Tidy up a nested CONFIG_IS_ENABLED(BOOTSTD) Simon Glass
2025-03-19 14:38 ` [PATCH 14/17] bootstd: Provide a command to select the bootdev order Simon Glass
2025-03-19 14:38 ` [PATCH 15/17] bootstd: Correct the comment for bootmeth_set_order() Simon Glass
2025-03-19 14:38 ` [PATCH 16/17] bootstd: Expand debugging in bootdev_find_in_blk() Simon Glass
2025-03-19 14:38 ` [PATCH 17/17] bootstd: Mention FS state in bootmeth_read_bootflow() Simon Glass
2025-03-31 17:40 ` [PATCH 00/17] bootstd: Useability improvements Tom Rini
2025-04-01 15:53   ` Simon Glass
2025-04-01 17:01     ` Tom Rini

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=20250401165037.GI5495@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=baruch@tkos.co.il \
    --cc=ilias.apalodimas@linaro.org \
    --cc=martyn.welch@collabora.com \
    --cc=mkorpershoek@baylibre.com \
    --cc=namcao@linutronix.de \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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.