Re: [PATCH master] nvmem: core: don't fail on positive callback value return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux