From patchwork Mon May 23 22:07:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Tobias Schandinat X-Patchwork-Id: 810182 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4NLp4WM002586 for ; Mon, 23 May 2011 21:51:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932177Ab1EWVvD (ORCPT ); Mon, 23 May 2011 17:51:03 -0400 Received: from mailout-de.gmx.net ([213.165.64.23]:46771 "HELO mailout-de.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757660Ab1EWVvC (ORCPT ); Mon, 23 May 2011 17:51:02 -0400 Received: (qmail invoked by alias); 23 May 2011 21:50:59 -0000 Received: from dslb-088-066-144-255.pools.arcor-ip.net (EHLO localhost.localdomain) [88.66.144.255] by mail.gmx.net (mp047) with SMTP; 23 May 2011 23:50:59 +0200 X-Authenticated: #10250065 X-Provags-ID: V01U2FsdGVkX1+s1fQWvjOsxWAqHvLHal4YGX4jRT8LqjXs8lKiHq dUcTDhswB51qI5 From: Florian Tobias Schandinat To: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Florian Tobias Schandinat , stable@kernel.org Subject: [PATCH] viafb: use display information in info not in var for panning Date: Mon, 23 May 2011 22:07:26 +0000 Message-Id: <1306188446-5160-1-git-send-email-FlorianSchandinat@gmx.de> X-Mailer: git-send-email 1.6.3.2 In-Reply-To: <201105232211.40154.laurent.pinchart@ideasonboard.com> References: <201105232211.40154.laurent.pinchart@ideasonboard.com> X-Y-GMX-Trusted: 0 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]); Mon, 23 May 2011 21:51:04 +0000 (UTC) As Laurent pointed out 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: Florian Tobias Schandinat Reported-by: Laurent Pinchart Cc: stable@kernel.org Acked-by: Laurent Pinchart --- drivers/video/via/viafbdev.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 3114a87..aa87529 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -348,8 +348,9 @@ static int viafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { struct viafb_par *viapar = info->par; - u32 vram_addr = (var->yoffset * var->xres_virtual + var->xoffset) - * (var->bits_per_pixel / 8) + viapar->vram_addr; + u32 vram_addr = viapar->vram_addr + + var->yoffset * info->fix.line_length + + var->xoffset * info->var.bits_per_pixel / 8; DEBUG_MSG(KERN_DEBUG "viafb_pan_display, address = %d\n", vram_addr); if (!viafb_dual_fb) {