mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH master] nvmem: core: don't fail on positive callback value return
Date: Fri, 9 Dec 2022 07:59:43 +0100	[thread overview]
Message-ID: <20221209065943.GF29728@pengutronix.de> (raw)
In-Reply-To: <20221207184634.140081-1-a.fatoum@pengutronix.de>

On Wed, Dec 07, 2022 at 07:46:34PM +0100, Ahmad Fatoum wrote:
> A sizable number of barebox NVMEM drivers returns a positive value of
> number of bytes read on success, while others return 0 unless an error
> occurred.
> 
> When we used to check for errors with IS_ERR_VALUE, both cases worked,
> because it wouldn't evaluate to true for positive numbers. Now with
> IS_ERR_VALUE removed, we need to explicitly check for negative values
> to determinte errors. Otherwise nvmem_cell_read becomes a death trap
> that returns values like (void *)2, which IS_ERR() won't catch and
> best case kfree() will crash on.

D'oh!

I copied this from the kernel and blindly assumed that the drivers
behave the same in barebox. I should have had a look.

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2022-12-09  7:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 18:46 Ahmad Fatoum
2022-12-09  6:59 ` Sascha Hauer [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=20221209065943.GF29728@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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