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: <745539ce-52ff-f56f-0f02-41894f366503@suse.de>
Date:   Tue, 27 Oct 2020 07:54:21 +0100
From:   Thomas Zimmermann <tzimmermann@...e.de>
To:     Arnd Bergmann <arnd@...nel.org>,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Cc:     Arnd Bergmann <arnd@...db.de>, linux-fbdev@...r.kernel.org,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] matroxfb: avoid -Warray-bounds warning

Hi

Am 26.10.20 um 20:39 schrieb Arnd Bergmann:
> From: Arnd Bergmann <arnd@...db.de>
> 
> The open-coded list_for_each_entry() causes a harmless warning:
> 
> drivers/video/fbdev/matrox/matroxfb_base.c: In function 'matroxfb_register_driver':
> include/linux/kernel.h:856:3: warning: array subscript -98 is outside array bounds of 'struct list_head[1]' [-Warray-bounds]
> 
> Use the normal list_for_each_entry instead.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

Acked-by: Thomas Zimmermann <tzimmermann@...e.de>

I'll add the patch to drm-misc-next. Thanks!

Best regards
Thomas

> ---
>  drivers/video/fbdev/matrox/matroxfb_base.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c
> index 570439b32655..a3853421b263 100644
> --- a/drivers/video/fbdev/matrox/matroxfb_base.c
> +++ b/drivers/video/fbdev/matrox/matroxfb_base.c
> @@ -1970,9 +1970,7 @@ int matroxfb_register_driver(struct matroxfb_driver* drv) {
>  	struct matrox_fb_info* minfo;
>  
>  	list_add(&drv->node, &matroxfb_driver_list);
> -	for (minfo = matroxfb_l(matroxfb_list.next);
> -	     minfo != matroxfb_l(&matroxfb_list);
> -	     minfo = matroxfb_l(minfo->next_fb.next)) {
> +	list_for_each_entry(minfo, &matroxfb_list, next_fb) {
>  		void* p;
>  
>  		if (minfo->drivers_count == MATROXFB_MAX_FB_DRIVERS)
> @@ -1990,9 +1988,7 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv) {
>  	struct matrox_fb_info* minfo;
>  
>  	list_del(&drv->node);
> -	for (minfo = matroxfb_l(matroxfb_list.next);
> -	     minfo != matroxfb_l(&matroxfb_list);
> -	     minfo = matroxfb_l(minfo->next_fb.next)) {
> +	list_for_each_entry(minfo, &matroxfb_list, next_fb) {
>  		int i;
>  
>  		for (i = 0; i < minfo->drivers_count; ) {
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ