[PATCH 6/6] Staging: unisys: visorutil: Clean up sparse warnings in visorutil code

Ken Cox jkc at redhat.com
Thu Mar 13 20:39:23 UTC 2014


Clean up code to get rid of sparse warnings.

Also fixed variable length arrays declared on the stack.

Signed-off-by: Ken Cox <jkc at redhat.com>
---
 drivers/staging/unisys/visorutil/procobjecttree.c | 2 +-
 drivers/staging/unisys/visorutil/visorkmodutils.c | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c
index e4d734e..7c7f001 100644
--- a/drivers/staging/unisys/visorutil/procobjecttree.c
+++ b/drivers/staging/unisys/visorutil/procobjecttree.c
@@ -150,7 +150,7 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot,
 	type->nNames = 0;
 	type->show_property = show_property;
 	type->procDirRoot = procDirRoot;
-	if (type->propertyNames != 0)
+	if (type->propertyNames != NULL)
 		while (type->propertyNames[type->nProperties] != NULL)
 			type->nProperties++;
 	while (type->name[type->nNames] != NULL)
diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c
index ed46208..f66acd9 100644
--- a/drivers/staging/unisys/visorutil/visorkmodutils.c
+++ b/drivers/staging/unisys/visorutil/visorkmodutils.c
@@ -20,8 +20,6 @@
 
 #define MYDRVNAME "timskmodutils"
 
-BOOL Debug_Malloc_Enabled = FALSE;
-
 /** Print the hexadecimal contents of a data buffer to a supplied print buffer.
  *  @param dest               the print buffer where text characters will
  *			      be written
@@ -42,8 +40,8 @@ int visor_hexDumpToBuffer(char *dest, int destSize, char *prefix, char *src,
 {
 	int i = 0;
 	int pos = 0;
-	char printable[bytesToDumpPerLine + 1];
-	char hex[(bytesToDumpPerLine * 3) + 1];
+	char printable[24];
+	char hex[64];
 	char *line = NULL;
 	int linesize = 1000;
 	int linelen = 0;
-- 
1.8.5.3



More information about the devel mailing list