lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171016092942.qw44e6qwd53ddazd@phenom.ffwll.local>
Date:   Mon, 16 Oct 2017 11:29:42 +0200
From:   Daniel Vetter <daniel@...ll.ch>
To:     Jérémy Lefaure <jeremy.lefaure@....epita.fr>
Cc:     David Airlie <airlied@...ux.ie>,
        Thierry Reding <treding@...dia.com>,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] drm/via: use ARRAY_SIZE

On Sun, Oct 15, 2017 at 10:33:56PM -0400, Jérémy Lefaure wrote:
> Using the ARRAY_SIZE macro improves the readability of the code.
> 
> Found with Coccinelle with the following semantic patch:
> @r depends on (org || report)@
> type T;
> T[] E;
> position p;
> @@
> (
>  (sizeof(E)@p /sizeof(*E))
> |
>  (sizeof(E)@p /sizeof(E[...]))
> |
>  (sizeof(E)@p /sizeof(T))
> )
> 
> Reviewed-by: Thierry Reding <treding@...dia.com>
> Signed-off-by: Jérémy Lefaure <jeremy.lefaure@....epita.fr>
> ---
> This patch was part of a bigger patch [1] reviewed by Thierry Reding
> before it was split in several patches.
> 
> [1]: https://patchwork.kernel.org/patch/9979843/
> 
>  drivers/gpu/drm/via/via_verifier.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)

Also applied to drm-misc-next.

Thanks, Daniel

> 
> diff --git a/drivers/gpu/drm/via/via_verifier.c b/drivers/gpu/drm/via/via_verifier.c
> index 0677bbf4ec7e..fb2609434df7 100644
> --- a/drivers/gpu/drm/via/via_verifier.c
> +++ b/drivers/gpu/drm/via/via_verifier.c
> @@ -34,6 +34,7 @@
>  #include <drm/drm_legacy.h>
>  #include "via_verifier.h"
>  #include "via_drv.h"
> +#include <linux/kernel.h>
>  
>  typedef enum {
>  	state_command,
> @@ -1102,10 +1103,7 @@ setup_hazard_table(hz_init_t init_table[], hazard_t table[], int size)
>  
>  void via_init_command_verifier(void)
>  {
> -	setup_hazard_table(init_table1, table1,
> -			   sizeof(init_table1) / sizeof(hz_init_t));
> -	setup_hazard_table(init_table2, table2,
> -			   sizeof(init_table2) / sizeof(hz_init_t));
> -	setup_hazard_table(init_table3, table3,
> -			   sizeof(init_table3) / sizeof(hz_init_t));
> +	setup_hazard_table(init_table1, table1, ARRAY_SIZE(init_table1));
> +	setup_hazard_table(init_table2, table2, ARRAY_SIZE(init_table2));
> +	setup_hazard_table(init_table3, table3, ARRAY_SIZE(init_table3));
>  }
> -- 
> 2.14.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ