]> git.ipfire.org Git - people/arne_f/kernel.git/commit
nvmem: core: fix read buffer in place
authorJorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Sat, 13 Apr 2019 10:32:58 +0000 (11:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Jun 2019 09:54:07 +0000 (11:54 +0200)
commit0412a8857198b7ac749041cf7e825e6e13c63df5
treeb906dfd89d3d4fcdb6df6387bbe9dcbf76346e6e
parent962ce4023178b363beeb4ebe8218379b7ca36d6b
nvmem: core: fix read buffer in place

[ Upstream commit 2fe518fecb3a4727393be286db9804cd82ee2d91 ]

When the bit_offset in the cell is zero, the pointer to the msb will
not be properly initialized (ie, will still be pointing to the first
byte in the buffer).

This being the case, if there are bits to clear in the msb, those will
be left untouched while the mask will incorrectly clear bit positions
on the first byte.

This commit also makes sure that any byte unused in the cell is
cleared.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvmem/core.c