mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
tty: vt: sanitize consw::con_putcs() parameters
Similar to con_putc() in the previous patch: * make the pointer to charattr a pointer to u16, and * make x, y, and count unsigned as they are strictly non-negative. And again, document that hook. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Tested-by: Helge Deller <deller@gmx.de> # parisc STI console Link: https://lore.kernel.org/r/20240122110401.7289-27-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
338c28107b
commit
bfd7de49d7
@ -59,10 +59,10 @@ static void dummycon_putc(struct vc_data *vc, u16 c, unsigned int y,
|
||||
raw_notifier_call_chain(&dummycon_output_nh, 0, NULL);
|
||||
}
|
||||
|
||||
static void dummycon_putcs(struct vc_data *vc, const unsigned short *s,
|
||||
int count, int ypos, int xpos)
|
||||
static void dummycon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
|
||||
unsigned int ypos, unsigned int xpos)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (!dummycon_putc_called) {
|
||||
/* Ignore erases */
|
||||
@ -87,8 +87,8 @@ static int dummycon_blank(struct vc_data *vc, int blank, int mode_switch)
|
||||
#else
|
||||
static void dummycon_putc(struct vc_data *vc, u16 c, unsigned int y,
|
||||
unsigned int x) { }
|
||||
static void dummycon_putcs(struct vc_data *vc, const unsigned short *s,
|
||||
int count, int ypos, int xpos) { }
|
||||
static void dummycon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
|
||||
unsigned int ypos, unsigned int xpos) { }
|
||||
static int dummycon_blank(struct vc_data *vc, int blank, int mode_switch)
|
||||
{
|
||||
return 0;
|
||||
|
@ -427,8 +427,8 @@ static inline u16 *mda_addr(unsigned int x, unsigned int y)
|
||||
return mda_vram_base + y * mda_num_columns + x;
|
||||
}
|
||||
|
||||
static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
|
||||
int count, int y, int x)
|
||||
static void mdacon_putcs(struct vc_data *c, const u16 *s, unsigned int count,
|
||||
unsigned int y, unsigned int x)
|
||||
{
|
||||
u16 *dest = mda_addr(x, y);
|
||||
|
||||
|
@ -396,12 +396,13 @@ static void newport_putc(struct vc_data *vc, u16 charattr, unsigned int ypos,
|
||||
RENDER(npregs, p);
|
||||
}
|
||||
|
||||
static void newport_putcs(struct vc_data *vc, const unsigned short *s,
|
||||
int count, int ypos, int xpos)
|
||||
static void newport_putcs(struct vc_data *vc, const u16 *s,
|
||||
unsigned int count, unsigned int ypos,
|
||||
unsigned int xpos)
|
||||
{
|
||||
int i;
|
||||
int charattr;
|
||||
unsigned char *p;
|
||||
unsigned int i;
|
||||
u16 charattr;
|
||||
|
||||
charattr = (scr_readw(s) >> 8) & 0xff;
|
||||
|
||||
|
@ -71,8 +71,8 @@ static const char *sticon_startup(void)
|
||||
return "STI console";
|
||||
}
|
||||
|
||||
static void sticon_putcs(struct vc_data *conp, const unsigned short *s,
|
||||
int count, int ypos, int xpos)
|
||||
static void sticon_putcs(struct vc_data *conp, const u16 *s, unsigned int count,
|
||||
unsigned int ypos, unsigned int xpos)
|
||||
{
|
||||
if (vga_is_gfx || console_blanked)
|
||||
return;
|
||||
|
@ -1193,8 +1193,8 @@ static bool vgacon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
|
||||
|
||||
static void vgacon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx,
|
||||
unsigned int width) { }
|
||||
static void vgacon_putcs(struct vc_data *vc, const unsigned short *s,
|
||||
int count, int ypos, int xpos) { }
|
||||
static void vgacon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
|
||||
unsigned int ypos, unsigned int xpos) { }
|
||||
|
||||
const struct consw vga_con = {
|
||||
.owner = THIS_MODULE,
|
||||
|
@ -1279,8 +1279,8 @@ static void fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx,
|
||||
__fbcon_clear(vc, sy, sx, 1, width);
|
||||
}
|
||||
|
||||
static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
|
||||
int count, int ypos, int xpos)
|
||||
static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
|
||||
unsigned int ypos, unsigned int xpos)
|
||||
{
|
||||
struct fb_info *info = fbcon_info_from_console(vc->vc_num);
|
||||
struct fbcon_display *p = &fb_display[vc->vc_num];
|
||||
|
@ -41,6 +41,7 @@ enum vc_intensity;
|
||||
* @con_clear: erase @count characters at [@x, @y] on @vc. @count >= 1.
|
||||
* @con_putc: emit one character with attributes @ca to [@x, @y] on @vc.
|
||||
* (optional -- @con_putcs would be called instead)
|
||||
* @con_putcs: emit @count characters with attributes @s to [@x, @y] on @vc.
|
||||
* @con_scroll: move lines from @top to @bottom in direction @dir by @lines.
|
||||
* Return true if no generic handling should be done.
|
||||
* Invoked by csi_M and printing to the console.
|
||||
@ -57,8 +58,9 @@ struct consw {
|
||||
unsigned int x, unsigned int count);
|
||||
void (*con_putc)(struct vc_data *vc, u16 ca, unsigned int y,
|
||||
unsigned int x);
|
||||
void (*con_putcs)(struct vc_data *vc, const unsigned short *s,
|
||||
int count, int ypos, int xpos);
|
||||
void (*con_putcs)(struct vc_data *vc, const u16 *s,
|
||||
unsigned int count, unsigned int ypos,
|
||||
unsigned int xpos);
|
||||
void (*con_cursor)(struct vc_data *vc, int mode);
|
||||
bool (*con_scroll)(struct vc_data *vc, unsigned int top,
|
||||
unsigned int bottom, enum con_scroll dir,
|
||||
|
Loading…
Reference in New Issue
Block a user