From patchwork Fri Jul 8 11:14:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 956552 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p68BEHJv032417 for ; Fri, 8 Jul 2011 11:14:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753383Ab1GHLOQ (ORCPT ); Fri, 8 Jul 2011 07:14:16 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:37839 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753228Ab1GHLOK (ORCPT ); Fri, 8 Jul 2011 07:14:10 -0400 Received: from localhost.localdomain (unknown [91.178.119.181]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E52AE35AA0 for ; Fri, 8 Jul 2011 11:14:06 +0000 (UTC) From: Laurent Pinchart To: linux-fbdev@vger.kernel.org Subject: [PATCH v3 06/29] radeonfb: use display information in info not in var for panning Date: Fri, 8 Jul 2011 13:14:20 +0200 Message-Id: <1310123683-8064-7-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1310123683-8064-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1310123683-8064-1-git-send-email-laurent.pinchart@ideasonboard.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 08 Jul 2011 11:14:24 +0000 (UTC) We must not use any information in the passed var besides xoffset, yoffset and vmode as otherwise applications might abuse it. Also use the aligned fix.line_length and not the (possible) unaligned xres_virtual. Signed-off-by: Laurent Pinchart Cc: Benjamin Herrenschmidt --- drivers/video/aty/radeon_base.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 32f8cf6..1506848 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c @@ -845,16 +845,16 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var, { struct radeonfb_info *rinfo = info->par; - if ((var->xoffset + var->xres > var->xres_virtual) - || (var->yoffset + var->yres > var->yres_virtual)) - return -EINVAL; + if ((var->xoffset + info->var.xres > info->var.xres_virtual) + || (var->yoffset + info->var.yres > info->var.yres_virtual)) + return -EINVAL; if (rinfo->asleep) return 0; radeon_fifo_wait(2); - OUTREG(CRTC_OFFSET, ((var->yoffset * var->xres_virtual + var->xoffset) - * var->bits_per_pixel / 8) & ~7); + OUTREG(CRTC_OFFSET, (var->yoffset * info->fix.line_length + + var->xoffset * info->var.bits_per_pixel / 8) & ~7); return 0; }