All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: atomisp: silence an array overflow warning
@ 2017-03-14  7:55 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2017-03-14  7:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Greg Kroah-Hartman, Alan Cox, linux-media, devel, linux-kernel,
	kernel-janitors

Static checkers complain that we should check if "i" is in bounds
before we check if "var8[i]" is a NUL char.  This bug is harmless but
also easy to fix.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index 65513cae93ce..1dd061f00cd9 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -669,7 +669,7 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t *
 	/* Our variable names are ASCII by construction, but EFI names
 	 * are wide chars.  Convert and zero-pad. */
 	memset(var16, 0, sizeof(var16));
-	for (i=0; var8[i] && i < sizeof(var8); i++)
+	for (i = 0; i < sizeof(var8) && var8[i]; i++)
 		var16[i] = var8[i];
 
 	/* To avoid owerflows when calling the efivar API */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] staging: atomisp: silence an array overflow warning
@ 2017-03-14  7:55 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2017-03-14  7:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Greg Kroah-Hartman, Alan Cox, linux-media, devel, linux-kernel,
	kernel-janitors

Static checkers complain that we should check if "i" is in bounds
before we check if "var8[i]" is a NUL char.  This bug is harmless but
also easy to fix.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index 65513cae93ce..1dd061f00cd9 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -669,7 +669,7 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t *
 	/* Our variable names are ASCII by construction, but EFI names
 	 * are wide chars.  Convert and zero-pad. */
 	memset(var16, 0, sizeof(var16));
-	for (i=0; var8[i] && i < sizeof(var8); i++)
+	for (i = 0; i < sizeof(var8) && var8[i]; i++)
 		var16[i] = var8[i];
 
 	/* To avoid owerflows when calling the efivar API */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-14  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14  7:55 [PATCH] staging: atomisp: silence an array overflow warning Dan Carpenter
2017-03-14  7:55 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.