diff options
author | Arnd Bergmann <arnd@arndb.de> | 2020-10-26 20:39:55 +0100 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2020-10-27 07:56:19 +0100 |
commit | 4dfec0d1d7b9970f36931de714b379dbeaed83f8 (patch) | |
tree | 36707e3c5b0184fb7136a830e420b186306a4b5e | |
parent | 70bb9193728627e84e02eb0960b0aa138ae2cef5 (diff) |
matroxfb: avoid -Warray-bounds warningdrm-misc-next-2020-10-27
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@arndb.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201026194010.3817166-1-arnd@kernel.org
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_base.c | 8 |
1 files 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; ) { |