Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54243cef authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds
Browse files

[PATCH] tdfxfb: Fix buffer overrun



The pseudo_palette has room only for 16 entries, but tdfxfb_setcolreg may
attempt to write more.

Coverity Bug 557

Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d3015247
Loading
Loading
Loading
Loading
+23 −19
Original line number Diff line number Diff line
@@ -794,6 +794,7 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
		break;
	/* Truecolor has no hardware color palettes. */
	case FB_VISUAL_TRUECOLOR:
		if (regno < 16) {
			rgbcol = (CNVT_TOHW( red, info->var.red.length) <<
				  info->var.red.offset) |
				(CNVT_TOHW( green, info->var.green.length) <<
@@ -803,11 +804,14 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
				(CNVT_TOHW( transp, info->var.transp.length) <<
				 info->var.transp.offset);
			par->palette[regno] = rgbcol;
		}

		break;
	default:
		DPRINTK("bad depth %u\n", info->var.bits_per_pixel);
		break;
	}

	return 0;
}