Commit bfd7de49 authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman
Browse files

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: default avatar"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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 338c2810
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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);

+5 −4
Original line number Diff line number Diff line
@@ -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;

+2 −2
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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,
Loading