diff options
-rw-r--r-- | drivers/video/fbmem.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 46ee5e5a08c6..5aac00eb1830 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -1573,15 +1573,15 @@ static int do_register_framebuffer(struct fb_info *fb_info) | |||
1573 | struct fb_event event; | 1573 | struct fb_event event; |
1574 | struct fb_videomode mode; | 1574 | struct fb_videomode mode; |
1575 | 1575 | ||
1576 | if (num_registered_fb == FB_MAX) | ||
1577 | return -ENXIO; | ||
1578 | |||
1579 | if (fb_check_foreignness(fb_info)) | 1576 | if (fb_check_foreignness(fb_info)) |
1580 | return -ENOSYS; | 1577 | return -ENOSYS; |
1581 | 1578 | ||
1582 | do_remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id, | 1579 | do_remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id, |
1583 | fb_is_primary_device(fb_info)); | 1580 | fb_is_primary_device(fb_info)); |
1584 | 1581 | ||
1582 | if (num_registered_fb == FB_MAX) | ||
1583 | return -ENXIO; | ||
1584 | |||
1585 | num_registered_fb++; | 1585 | num_registered_fb++; |
1586 | for (i = 0 ; i < FB_MAX; i++) | 1586 | for (i = 0 ; i < FB_MAX; i++) |
1587 | if (!registered_fb[i]) | 1587 | if (!registered_fb[i]) |
@@ -1639,7 +1639,7 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) | |||
1639 | int i, ret = 0; | 1639 | int i, ret = 0; |
1640 | 1640 | ||
1641 | i = fb_info->node; | 1641 | i = fb_info->node; |
1642 | if (!registered_fb[i]) | 1642 | if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) |
1643 | return -EINVAL; | 1643 | return -EINVAL; |
1644 | 1644 | ||
1645 | if (!lock_fb_info(fb_info)) | 1645 | if (!lock_fb_info(fb_info)) |