All of lore.kernel.org
 help / color / mirror / Atom feed
* [Devel] [PATCH] compiler: remove unnecessary zero check on Length before zero'ing it
@ 2016-01-07 10:21 Colin King
  0 siblings, 0 replies; 2+ messages in thread
From: Colin King @ 2016-01-07 10:21 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]

From: Colin Ian King <colin.king(a)canonical.com>

Length is being checked to see if the contents is non-zero before
setting it to zero. It would be simpler to just set this to zero
without doing the non-zero check as it saves a load and a jmp
(~14 bytes in x86 object code). This also fixes a static analysis
warning in DtCompileIort:

CID 1298707 (#1 of 1): Uninitialized scalar variable (UNINIT).
  uninit_use_in_call: Using uninitialized value PaddingLength
  when calling DtCompileGeneric.

..since the length is not being intitialized in this code before
calling DtCompileGeneric.

Signed-off-by: Colin Ian King <colin.king(a)canonical.com>
---
 source/compiler/dttable2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c
index b281b5c..1add6f7 100644
--- a/source/compiler/dttable2.c
+++ b/source/compiler/dttable2.c
@@ -1707,7 +1707,7 @@ DtCompileGeneric (
 
     /* Now we can actually compile the parse tree */
 
-    if (Length && *Length)
+    if (Length)
     {
         *Length = 0;
     }
-- 
2.7.0.rc3


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

* Re: [Devel] [PATCH] compiler: remove unnecessary zero check on Length before zero'ing it
@ 2016-02-17  5:58 Zheng, Lv
  0 siblings, 0 replies; 2+ messages in thread
From: Zheng, Lv @ 2016-02-17  5:58 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1593 bytes --]

Hi,

> From: Devel [mailto:devel-bounces(a)acpica.org] On Behalf Of Colin King
> Subject: [Devel] [PATCH] compiler: remove unnecessary zero check on Length
> before zero'ing it
> 
> From: Colin Ian King <colin.king(a)canonical.com>
> 
> Length is being checked to see if the contents is non-zero before
> setting it to zero. It would be simpler to just set this to zero
> without doing the non-zero check as it saves a load and a jmp
> (~14 bytes in x86 object code). This also fixes a static analysis
> warning in DtCompileIort:
> 
> CID 1298707 (#1 of 1): Uninitialized scalar variable (UNINIT).
>   uninit_use_in_call: Using uninitialized value PaddingLength
>   when calling DtCompileGeneric.
> 
> ..since the length is not being intitialized in this code before
> calling DtCompileGeneric.
> 
> Signed-off-by: Colin Ian King <colin.king(a)canonical.com>

Acked-by: Lv Zheng <lv.zheng(a)intel.com>

Thanks
-Lv

> ---
>  source/compiler/dttable2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c
> index b281b5c..1add6f7 100644
> --- a/source/compiler/dttable2.c
> +++ b/source/compiler/dttable2.c
> @@ -1707,7 +1707,7 @@ DtCompileGeneric (
> 
>      /* Now we can actually compile the parse tree */
> 
> -    if (Length && *Length)
> +    if (Length)
>      {
>          *Length = 0;
>      }
> --
> 2.7.0.rc3
> 
> _______________________________________________
> Devel mailing list
> Devel(a)acpica.org
> https://lists.acpica.org/mailman/listinfo/devel

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

end of thread, other threads:[~2016-02-17  5:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 10:21 [Devel] [PATCH] compiler: remove unnecessary zero check on Length before zero'ing it Colin King
2016-02-17  5:58 Zheng, Lv

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.