lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1181647677482-git-send-email-hskinnemoen@atmel.com>
Date:	Tue, 12 Jun 2007 13:27:57 +0200
From:	Haavard Skinnemoen <hskinnemoen@...el.com>
To:	Nicolas Ferre <nicolas.ferre@....atmel.com>
Cc:	linux-fbdev-devel@...ts.sourceforge.net,
	Andrew Victor <andrew@...people.com>,
	"Antonino A. Daplas" <adaplas@...il.com>,
	Linux Kernel list <linux-kernel@...r.kernel.org>,
	Jan Altenberg <jan.altenberg@...utronix.de>,
	Patrice Vilchez <patrice.vilchez@....atmel.com>,
	Haavard Skinnemoen <hskinnemoen@...el.com>
Subject: [PATCH] atmel_lcdfb: Fix wrong line_length calculation

As Jan Altenberg pointed out, line_length will always be 0 if
bits_per_pixel < 8. Fix this and also make sure that we round up to
the nearest byte.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@...el.com>
---
I haven't tested this with any real program that uses the frame buffer,
but fbset seems to report sane values for line_length:

-sh-3.2# fbset -i

mode "320x240-68"
    # D: 6.891 MHz, H: 17.852 kHz, V: 68.400 Hz
    geometry 320 240 320 240 4
    timings 145116 17 33 10 10 16 1
    rgba 4/0,4/0,4/0,0/0
endmode

Frame buffer device information:
    Name        :
    Address     : 0x102c0000
    Size        : 230400
    Type        : PACKED PIXELS
    Visual      : PSEUDOCOLOR
    XPanStep    : 0
    YPanStep    : 0
    YWrapStep   : 0
    LineLength  : 160
    MMIO Address: 0xff000000
    MMIO Size   : 4096
    Accelerator : No

The XPanStep and YPanStep values are wrong though. Nicolas, I suspect
YPanStep should be 1 on AT91 as well since the only thing required is
the ability to change the DMA base address. The DMA2D stuff is only
required for X panning if I understand it correctly.

 drivers/video/atmel_lcdfb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index e1d5bd0..695d520 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -230,6 +230,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
 	struct atmel_lcdfb_info *sinfo = info->par;
 	unsigned long value;
 	unsigned long clk_value_khz;
+	unsigned long bits_per_line;
 
 	dev_dbg(info->device, "%s:\n", __func__);
 	dev_dbg(info->device, "  * resolution: %ux%u (%ux%u virtual)\n",
@@ -246,7 +247,8 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
 	else
 		info->fix.visual = FB_VISUAL_TRUECOLOR;
 
-	info->fix.line_length = info->var.xres_virtual * (info->var.bits_per_pixel / 8);
+	bits_per_line = info->var.xres_virtual * info->var.bits_per_pixel;
+	info->fix.line_length = DIV_ROUND_UP(bits_per_line, 8);
 
 	/* Re-initialize the DMA engine... */
 	dev_dbg(info->device, "  * update DMA engine\n");
-- 
1.4.4.4

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ