[PATCH 0/3] nvmem: Bring a tiny bit of sanity to reading 16/32/64 bits from nvmem

From: Douglas Anderson
Date: Fri Feb 26 2021 - 19:27:07 EST


This series was inspried by a KASAN warning that I got at bootup caused
by the GPU driver on my system interfacing with the nvmem API incorrectly.

I have posted a fix for the GPU driver but looking at this nvmem entry
made me question how the nvmem API was supposed to work. I've proposed
some improvements and these seem better (to me) than any of:
- Open coding logic like that in "cpr.c" in the GPU driver.
- Ignoring the problem and just forcing everyone in the future to
always specify a length of "2" for the GPU speed bin cells.
- Ignoring the problem and specifying a length of "4" for the GPU
speed bin cells.

About applying the patches.
- GPU patch can land on its own. No need for the nvmem patches.
- nvmem patches can land on their own too.
- If the second nvmem patch lands without the first, however, it will
break the GPU patch.


Douglas Anderson (3):
drm/msm: Fix speed-bin support not to access outside valid memory
nvmem: core: Allow nvmem_cell_read_u16/32/64 to read smaller cells
nvmem: core: nvmem_cell_read() should return the true size

drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 31 +++++++--------------------
drivers/nvmem/core.c | 30 ++++++++++++++++++++++----
2 files changed, 34 insertions(+), 27 deletions(-)

--
2.30.1.766.gb4fecdf3b7-goog