mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Hyeonjun Hong <hyeonjunhong330@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 2/2] media: rcar-isp: Fail buffer preparation if the ConfigDMA buffer is full
Date: Wed, 2 Dec 2026 18:06:06 +0100	[thread overview]
Message-ID: <20261202170606.GL3157946@ragnatech.se> (raw)
In-Reply-To: <20261202164311.745594-1-hyeonjunhong330@gmail.com>

Hello Hyeonjun,

On 2026-12-03 01:43:11 +0900, Hyeonjun Hong wrote:
> Hi Niklas,
> 
> On 2026-12-02 17:31:00 +0100, Niklas Söderlund wrote:
> > ... This check while also setting the new overflow flag will return
> > -ENOMEM ...
> [...]
> > ... Which will be propagated and returned here ...
> 
> I do not think it is propagated. The block handlers ignore the return
> value of the write callback and return 0, e.g. rppx1_ccor_fill_params():
> 
> 	write(priv, mod->base + CCOR_COEFF_REG(0), 0x1000);
> 	[...]
> 	return 0;
> 
> None of the write() calls in the rppx1_*.c handlers is checked, so
> rppx1_params() returns 0 after the buffer is full. In the userspace
> model, with only patch 1/2 applied, 700 header-only CCOR_POST blocks
> give 2047 pairs written and rppx1_params() == 0.

You are correct, my bad. And that's not very nice and likely something 
that should be fixed.. I can't think of a nice idea right now other then 
patching all rppx1_*.c handlers, let me think on it. Or if you have a 
nice idea?

I think fixing this design flaw is the right solution. Or if we go 
another way changing the write() callback to void so it is obvious the 
return value is not used.

> 
> > I don't like adding a flag for this, and it's not needed...
> 
> Understood. Would you prefer one of these instead?
> 
>  a) No flag, keep counting in the callback and check the count
>     afterwards:
> 
> 	if (desc->count++ >= RISP_IO_PARAMS_MAX_PAIRS)
> 		return -ENOMEM;
> 
>     and in risp_io_params_buffer_prepare():
> 
> 	if (desc.count > RISP_IO_PARAMS_MAX_PAIRS)
> 		return -ENOMEM;
> 
>  b) Make the rppx1 block handlers check and return the result of
>     write(). That is the proper fix but touches about 170 call sites
>     in rppx1.

If we can't think of something smarter I think this. Or do option (a) 
and switch the writer callback to void to make it clear the return value 
is not used.

> 
>  c) Drop patch 2/2 and leave it as is.
> 
> Thanks,
> Hyeonjun

-- 
Kind Regards,
Niklas Söderlund

      reply	other threads:[~2026-12-02 17:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 15:17 [PATCH 0/2] media: rcar-isp: Fix ConfigDMA buffer overflow Hyeonjun Hong
2026-12-02 15:17 ` [PATCH 1/2] media: rcar-isp: Account for the header in the ConfigDMA bounds check Hyeonjun Hong
2026-12-02 16:26   ` Niklas Söderlund
2026-12-02 16:38     ` Hyeonjun Hong
2026-12-02 16:43       ` Niklas Söderlund
2026-12-02 16:52         ` Hyeonjun Hong
2026-12-02 17:12           ` Niklas Söderlund
2026-12-02 15:17 ` [PATCH 2/2] media: rcar-isp: Fail buffer preparation if the ConfigDMA buffer is full Hyeonjun Hong
2026-12-02 16:31   ` Niklas Söderlund
2026-12-02 16:43     ` Hyeonjun Hong
2026-12-02 17:06       ` Niklas Söderlund [this message]

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=20261202170606.GL3157946@ragnatech.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=geert+renesas@glider.be \
    --cc=hyeonjunhong330@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=stable@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®