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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 03/16/2014 05:13 PM, Mark Einon wrote:
On 13/03/14 20:39, Ken Cox wrote:
Clean up code to get rid of sparse warnings.

Also fixed variable length arrays declared on the stack.

Signed-off-by: Ken Cox <jkc@xxxxxxxxxx>
---
  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];

Hi,

This isn't a good fix - this introduces a bug as later in this function,
'printable' and 'hex' are memset and assigned using the bytesToDumpPerLine parameter.
I'll get rid of this function altogether and just use hex_dump_to_buffer(). Revised patch coming soon.

Cheers,

Mark



      char *line = NULL;
      int linesize = 1000;
      int linelen = 0;



_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux