media: video: tegra: sh532u: fix out-of-bounds read
Deepak Nibade [Fri, 23 Nov 2012 08:21:59 +0000 (13:21 +0530)]
fix Coverity issue
Coverity id : 13692

Bug 1046331
Bug 1049868

Change-Id: Iefa6d076d4622368534710630b89b9a15d166378
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/165864
(cherry picked from commit db33c3f3f2447a52a40f4fd001fec9a2932ee4c8)
Reviewed-on: http://git-master/r/244637
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Tested-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-by: Kiran Adduri <kadduri@nvidia.com>
Reviewed-by: Erik Lilliebjerg <elilliebjerg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
Tested-by: Matthew Pedro <mapedro@nvidia.com>

drivers/media/video/tegra/sh532u.c

index e41dd1f..b9f9b91 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * SH532U focuser driver.
  *
- * Copyright (C) 2011-2012 NVIDIA Corporation.
+ * Copyright (C) 2011-2013 NVIDIA Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -386,7 +386,7 @@ static void sh532u_gpio_exit(struct sh532u_info *info)
 {
        unsigned i;
 
-       for (i = 0; i <= ARRAY_SIZE(sh532u_gpios); i++) {
+       for (i = 0; i < ARRAY_SIZE(sh532u_gpios); i++) {
                if (info->gpio[i].flag && info->gpio[i].own) {
                        gpio_free(info->gpio[i].gpio);
                        info->gpio[i].own = false;