diff options
author | Axel Lin <axel.lin@ingics.com> | 2015-09-30 14:35:15 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-04 13:09:43 +0200 |
commit | cbf854ab36870b931aeba4edd954015b7c3005a2 (patch) | |
tree | 07ceaff2d1e55a202a13f35e9685c27f34712432 /drivers/nvmem | |
parent | nvmem: core: fix the out-of-range leak in read/write() (diff) | |
download | linux-cbf854ab36870b931aeba4edd954015b7c3005a2.tar.xz linux-cbf854ab36870b931aeba4edd954015b7c3005a2.zip |
nvmem: core: Handle shift bits in-place if cell->nbits is non-zero
It's pointless to test (cell->bit_offset || cell->bit_offset).
nvmem_shift_read_buffer_in_place() should be called when
(cell->bit_offset || cell->nbits).
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r-- | drivers/nvmem/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index f4af8e5fcd94..676607cb01bb 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -825,7 +825,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem, return rc; /* shift bits in-place */ - if (cell->bit_offset || cell->bit_offset) + if (cell->bit_offset || cell->nbits) nvmem_shift_read_buffer_in_place(cell, buf); *len = cell->bytes; |