Skip to content

Commit bdefc8c

Browse files
Dan CarpenterBen Skeggs
authored andcommitted
drm/nv50/disp: min/max are reversed in nv50_crtc_gamma_set()
We should be taking the minimum here instead of the max. It could lead to a buffer overflow. Fixes: 438d99e ('drm/nvd0/disp: initial crtc object implementation') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> a/drm/nv50_display.c b/drm/nv50_display.c index f8e66c0..4e384a2 100644
1 parent 13cd1a5 commit bdefc8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/nouveau/nv50_display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
12651265
uint32_t start, uint32_t size)
12661266
{
12671267
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
1268-
u32 end = max(start + size, (u32)256);
1268+
u32 end = min_t(u32, start + size, 256);
12691269
u32 i;
12701270

12711271
for (i = start; i < end; i++) {

0 commit comments

Comments
 (0)