[PATCH 6/6] Staging: unisys: visorutil: Clean up sparse warnings in visorutil code
Mark Einon
mark at einon.net
Sun Mar 16 22:13:35 UTC 2014
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 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];
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.
Cheers,
Mark
> char *line = NULL;
> int linesize = 1000;
> int linelen = 0;
>
More information about the devel
mailing list