Skip to content

Commit b429665

Browse files
committed
Merge tag 'fbdev-for-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev updates from Helge Deller: "Many small but important fixes for special cases in the fbdev, fbcon and vgacon code which were found with Syzkaller, Svace and other tools by various people and teams (e.g. Linux Verification Center). Some smaller code cleanups in the nvidiafb, arkfb, atyfb and viafb drivers and two spelling fixes" * tag 'fbdev-for-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: fbdev: Fix fb_set_var to prevent null-ptr-deref in fb_videomode_to_var fbdev: Fix do_register_framebuffer to prevent null-ptr-deref in fb_videomode_to_var fbdev: sstfb.rst: Fix spelling mistake fbdev: core: fbcvt: avoid division by 0 in fb_cvt_hperiod() fbcon: Make sure modelist not set on unregistered console vgacon: Add check for vc_origin address range in vgacon_scroll() fbdev: arkfb: Cast ics5342_init() allocation type fbdev: nvidiafb: Correct const string length in nvidiafb_setup() fbdev: atyfb: Remove unused PCI vendor ID fbdev: carminefb: Fix spelling mistake of CARMINE_TOTAL_DIPLAY_MEM fbdev: via: use new GPIO line value setter callbacks
2 parents 4cb6c8a + 05f6e18 commit b429665

File tree

11 files changed

+37
-28
lines changed

11 files changed

+37
-28
lines changed

Documentation/fb/sstfb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Todo
192192
- Get rid of the previous paragraph.
193193
- Buy more coffee.
194194
- test/port to other arch.
195-
- try to add panning using tweeks with front and back buffer .
195+
- try to add panning using tweaks with front and back buffer.
196196
- try to implement accel on voodoo2, this board can actually do a
197197
lot in 2D even if it was sold as a 3D only board ...
198198

drivers/video/console/vgacon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ static bool vgacon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
11681168
c->vc_screenbuf_size - delta);
11691169
c->vc_origin = vga_vram_end - c->vc_screenbuf_size;
11701170
vga_rolled_over = 0;
1171-
} else
1171+
} else if (oldo - delta >= (unsigned long)c->vc_screenbuf)
11721172
c->vc_origin -= delta;
11731173
c->vc_scr_end = c->vc_origin + c->vc_screenbuf_size;
11741174
scr_memsetw((u16 *) (c->vc_origin), c->vc_video_erase_char,

drivers/video/fbdev/arkfb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,10 @@ static struct dac_ops ics5342_ops = {
431431

432432
static struct dac_info * ics5342_init(dac_read_regs_t drr, dac_write_regs_t dwr, void *data)
433433
{
434-
struct dac_info *info = kzalloc(sizeof(struct ics5342_info), GFP_KERNEL);
434+
struct ics5342_info *ics_info = kzalloc(sizeof(struct ics5342_info), GFP_KERNEL);
435+
struct dac_info *info = &ics_info->dac;
435436

436-
if (! info)
437+
if (!ics_info)
437438
return NULL;
438439

439440
info->dacops = &ics5342_ops;

drivers/video/fbdev/carminefb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,13 +649,13 @@ static int carminefb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
649649
* is required for that largest resolution to avoid remaps at run
650650
* time
651651
*/
652-
if (carminefb_fix.smem_len > CARMINE_TOTAL_DIPLAY_MEM)
653-
carminefb_fix.smem_len = CARMINE_TOTAL_DIPLAY_MEM;
652+
if (carminefb_fix.smem_len > CARMINE_TOTAL_DISPLAY_MEM)
653+
carminefb_fix.smem_len = CARMINE_TOTAL_DISPLAY_MEM;
654654

655-
else if (carminefb_fix.smem_len < CARMINE_TOTAL_DIPLAY_MEM) {
655+
else if (carminefb_fix.smem_len < CARMINE_TOTAL_DISPLAY_MEM) {
656656
printk(KERN_ERR "carminefb: Memory bar is only %d bytes, %d "
657657
"are required.", carminefb_fix.smem_len,
658-
CARMINE_TOTAL_DIPLAY_MEM);
658+
CARMINE_TOTAL_DISPLAY_MEM);
659659
goto err_unmap_vregs;
660660
}
661661

drivers/video/fbdev/carminefb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#define MAX_DISPLAY 2
99
#define CARMINE_DISPLAY_MEM (800 * 600 * 4)
10-
#define CARMINE_TOTAL_DIPLAY_MEM (CARMINE_DISPLAY_MEM * MAX_DISPLAY)
10+
#define CARMINE_TOTAL_DISPLAY_MEM (CARMINE_DISPLAY_MEM * MAX_DISPLAY)
1111

1212
#define CARMINE_USE_DISPLAY0 (1 << 0)
1313
#define CARMINE_USE_DISPLAY1 (1 << 1)

drivers/video/fbdev/core/fbcon.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,14 @@ static signed char con2fb_map_boot[MAX_NR_CONSOLES];
117117

118118
static struct fb_info *fbcon_info_from_console(int console)
119119
{
120+
signed char fb;
120121
WARN_CONSOLE_UNLOCKED();
121122

122-
return fbcon_registered_fb[con2fb_map[console]];
123+
fb = con2fb_map[console];
124+
if (fb < 0 || fb >= ARRAY_SIZE(fbcon_registered_fb))
125+
return NULL;
126+
127+
return fbcon_registered_fb[fb];
123128
}
124129

125130
static int logo_lines;

drivers/video/fbdev/core/fbcvt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb)
312312
cvt.f_refresh = cvt.refresh;
313313
cvt.interlace = 1;
314314

315-
if (!cvt.xres || !cvt.yres || !cvt.refresh) {
315+
if (!cvt.xres || !cvt.yres || !cvt.refresh || cvt.f_refresh > INT_MAX) {
316316
printk(KERN_INFO "fbcvt: Invalid input parameters\n");
317317
return 1;
318318
}

drivers/video/fbdev/core/fbmem.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,10 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
328328
!list_empty(&info->modelist))
329329
ret = fb_add_videomode(&mode, &info->modelist);
330330

331-
if (ret)
331+
if (ret) {
332+
info->var = old_var;
332333
return ret;
334+
}
333335

334336
event.info = info;
335337
event.data = &mode;
@@ -388,7 +390,7 @@ static int fb_check_foreignness(struct fb_info *fi)
388390

389391
static int do_register_framebuffer(struct fb_info *fb_info)
390392
{
391-
int i;
393+
int i, err = 0;
392394
struct fb_videomode mode;
393395

394396
if (fb_check_foreignness(fb_info))
@@ -397,10 +399,18 @@ static int do_register_framebuffer(struct fb_info *fb_info)
397399
if (num_registered_fb == FB_MAX)
398400
return -ENXIO;
399401

400-
num_registered_fb++;
401402
for (i = 0 ; i < FB_MAX; i++)
402403
if (!registered_fb[i])
403404
break;
405+
406+
if (!fb_info->modelist.prev || !fb_info->modelist.next)
407+
INIT_LIST_HEAD(&fb_info->modelist);
408+
409+
fb_var_to_videomode(&mode, &fb_info->var);
410+
err = fb_add_videomode(&mode, &fb_info->modelist);
411+
if (err < 0)
412+
return err;
413+
404414
fb_info->node = i;
405415
refcount_set(&fb_info->count, 1);
406416
mutex_init(&fb_info->lock);
@@ -426,16 +436,12 @@ static int do_register_framebuffer(struct fb_info *fb_info)
426436
if (bitmap_empty(fb_info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT))
427437
bitmap_fill(fb_info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT);
428438

429-
if (!fb_info->modelist.prev || !fb_info->modelist.next)
430-
INIT_LIST_HEAD(&fb_info->modelist);
431-
432439
if (fb_info->skip_vt_switch)
433440
pm_vt_switch_required(fb_info->device, false);
434441
else
435442
pm_vt_switch_required(fb_info->device, true);
436443

437-
fb_var_to_videomode(&mode, &fb_info->var);
438-
fb_add_videomode(&mode, &fb_info->modelist);
444+
num_registered_fb++;
439445
registered_fb[i] = fb_info;
440446

441447
#ifdef CONFIG_GUMSTIX_AM200EPD

drivers/video/fbdev/nvidia/nvidia.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ static int nvidiafb_setup(char *options)
14841484
flatpanel = 1;
14851485
} else if (!strncmp(this_opt, "hwcur", 5)) {
14861486
hwcur = 1;
1487-
} else if (!strncmp(this_opt, "noaccel", 6)) {
1487+
} else if (!strncmp(this_opt, "noaccel", 7)) {
14881488
noaccel = 1;
14891489
} else if (!strncmp(this_opt, "noscale", 7)) {
14901490
noscale = 1;

drivers/video/fbdev/via/via-gpio.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ struct viafb_gpio_cfg {
8181
/*
8282
* GPIO access functions
8383
*/
84-
static void via_gpio_set(struct gpio_chip *chip, unsigned int nr,
85-
int value)
84+
static int via_gpio_set(struct gpio_chip *chip, unsigned int nr, int value)
8685
{
8786
struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip);
8887
u8 reg;
@@ -99,13 +98,14 @@ static void via_gpio_set(struct gpio_chip *chip, unsigned int nr,
9998
reg &= ~(0x10 << gpio->vg_mask_shift);
10099
via_write_reg(VIASR, gpio->vg_port_index, reg);
101100
spin_unlock_irqrestore(&cfg->vdev->reg_lock, flags);
101+
102+
return 0;
102103
}
103104

104105
static int via_gpio_dir_out(struct gpio_chip *chip, unsigned int nr,
105106
int value)
106107
{
107-
via_gpio_set(chip, nr, value);
108-
return 0;
108+
return via_gpio_set(chip, nr, value);
109109
}
110110

111111
/*
@@ -146,7 +146,7 @@ static struct viafb_gpio_cfg viafb_gpio_config = {
146146
.label = "VIAFB onboard GPIO",
147147
.owner = THIS_MODULE,
148148
.direction_output = via_gpio_dir_out,
149-
.set = via_gpio_set,
149+
.set_rv = via_gpio_set,
150150
.direction_input = via_gpio_dir_input,
151151
.get = via_gpio_get,
152152
.base = -1,

0 commit comments

Comments
 (0)