From patchwork Wed Aug 31 11:00:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1115472 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 p7VB0ZOS023798 for ; Wed, 31 Aug 2011 11:00:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755057Ab1HaLAg (ORCPT ); Wed, 31 Aug 2011 07:00:36 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:54385 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754745Ab1HaLAf (ORCPT ); Wed, 31 Aug 2011 07:00:35 -0400 Received: from localhost.localdomain (unknown [91.178.27.34]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 81E4B35AAA; Wed, 31 Aug 2011 11:00:33 +0000 (UTC) From: Laurent Pinchart To: linux-fbdev@vger.kernel.org Cc: linux-sh@vger.kernel.org, magnus.damm@gmail.com, dhobsong@igel.co.jp Subject: [PATCH v2 4/8] fbdev: sh_mobile_lcdc: use display information in info for panning Date: Wed, 31 Aug 2011 13:00:55 +0200 Message-Id: <1314788459-31791-5-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1314788459-31791-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1314788459-31791-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]); Wed, 31 Aug 2011 11:00:37 +0000 (UTC) We must not use any information in the passed var besides xoffset, yoffset and vmode as otherwise applications might abuse it. Signed-off-by: Laurent Pinchart --- drivers/video/sh_mobile_lcdcfb.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index f9f420d..1ff215c 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -877,12 +877,12 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var, unsigned long base_addr_y, base_addr_c; unsigned long c_offset; - if (!var->nonstd) - new_pan_offset = (var->yoffset * info->fix.line_length) + - (var->xoffset * (info->var.bits_per_pixel / 8)); + if (!info->var.nonstd) + new_pan_offset = var->yoffset * info->fix.line_length + + var->xoffset * (info->var.bits_per_pixel / 8); else - new_pan_offset = (var->yoffset * info->fix.line_length) + - (var->xoffset); + new_pan_offset = var->yoffset * info->fix.line_length + + var->xoffset; if (new_pan_offset == ch->pan_offset) return 0; /* No change, do nothing */ @@ -891,13 +891,13 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var, /* Set the source address for the next refresh */ base_addr_y = ch->dma_handle + new_pan_offset; - if (var->nonstd) { + if (info->var.nonstd) { /* Set y offset */ - c_offset = (var->yoffset * - info->fix.line_length * - (info->var.bits_per_pixel - 8)) / 8; - base_addr_c = ch->dma_handle + var->xres * var->yres_virtual + - c_offset; + c_offset = var->yoffset * info->fix.line_length + * (info->var.bits_per_pixel - 8) / 8; + base_addr_c = ch->dma_handle + + info->var.xres * info->var.yres_virtual + + c_offset; /* Set x offset */ if (info->var.bits_per_pixel == 24) base_addr_c += 2 * var->xoffset; @@ -923,7 +923,7 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var, ch->base_addr_c = base_addr_c; lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y); - if (var->nonstd) + if (info->var.nonstd) lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c); if (lcdc_chan_is_sublcd(ch))