summaryrefslogtreecommitdiff
path: root/drivers/nvmem/mxs-ocotp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-07 10:53:32 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-07 10:53:32 -0700
commit32cf95db22d49cf4a3b421ba9fd156bb5f920ebb (patch)
tree48df4fe0b994c33155c7b19269621f6c122fee60 /drivers/nvmem/mxs-ocotp.c
parent630aac5ab6d6708c2cf715ddb5a77928e0aacb04 (diff)
parentd1306eb675ad7a9a760b6b8e8e189824b8db89e7 (diff)
Merge tag 'char-misc-4.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull misc driver fixes from Gfreg KH: "Here are three small fixes for some driver problems that were reported. Full details in the shortlog below. All of these have been in linux-next with no reported issues" * tag 'char-misc-4.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: nvmem: mxs-ocotp: fix buffer overflow in read Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read() misc: mic: Fix for double fetch security bug in VOP driver
Diffstat (limited to 'drivers/nvmem/mxs-ocotp.c')
-rw-r--r--drivers/nvmem/mxs-ocotp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvmem/mxs-ocotp.c b/drivers/nvmem/mxs-ocotp.c
index 8ba19bba3156..2bb3c5799ac4 100644
--- a/drivers/nvmem/mxs-ocotp.c
+++ b/drivers/nvmem/mxs-ocotp.c
@@ -94,7 +94,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size,
if (ret)
goto close_banks;
- while (val_size) {
+ while (val_size >= reg_size) {
if ((offset < OCOTP_DATA_OFFSET) || (offset % 16)) {
/* fill up non-data register */
*buf = 0;
@@ -103,7 +103,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size,
}
buf++;
- val_size--;
+ val_size -= reg_size;
offset += reg_size;
}