0062-i2c-qup-off-by-ones-in-qup_i2c_probe.patch 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. From aa50d1b0d81e4a9509f15894ec64013aa5190b59 Mon Sep 17 00:00:00 2001
  2. From: Dan Carpenter <[email protected]>
  3. Date: Thu, 3 Apr 2014 10:22:54 +0300
  4. Subject: [PATCH 062/182] i2c: qup: off by ones in qup_i2c_probe()
  5. These should ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".
  6. Fixes: 10c5a8425968 ('i2c: qup: New bus driver for the Qualcomm QUP I2C controller')
  7. Signed-off-by: Dan Carpenter <[email protected]>
  8. Signed-off-by: Wolfram Sang <[email protected]>
  9. ---
  10. drivers/i2c/busses/i2c-qup.c | 4 ++--
  11. 1 file changed, 2 insertions(+), 2 deletions(-)
  12. --- a/drivers/i2c/busses/i2c-qup.c
  13. +++ b/drivers/i2c/busses/i2c-qup.c
  14. @@ -633,12 +633,12 @@ static int qup_i2c_probe(struct platform
  15. * associated with each byte written/received
  16. */
  17. size = QUP_OUTPUT_BLOCK_SIZE(io_mode);
  18. - if (size > ARRAY_SIZE(blk_sizes))
  19. + if (size >= ARRAY_SIZE(blk_sizes))
  20. return -EIO;
  21. qup->out_blk_sz = blk_sizes[size] / 2;
  22. size = QUP_INPUT_BLOCK_SIZE(io_mode);
  23. - if (size > ARRAY_SIZE(blk_sizes))
  24. + if (size >= ARRAY_SIZE(blk_sizes))
  25. return -EIO;
  26. qup->in_blk_sz = blk_sizes[size] / 2;