All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hogan <james@albanarts.com>
To: linux-fbdev@vger.kernel.org
Subject: fb_write unaligned writes
Date: Thu, 09 Sep 2010 22:38:43 +0000	[thread overview]
Message-ID: <201009092338.59880.james@albanarts.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]

Hi,

I came across a problem in fb_write (drivers/video/fbmem.c) which doesn't make 
any effort to avoid unaligned writes. It copies up to a page at a time from 
userspace into a buffer, then fb_writel's as much as possible from the buffer 
into the framebuffer, then fb_writeb's any remaining bytes. However on 
architectures which don't perform unaligned writes this can cause a bus error 
or silently fail when it tries to fb_writel to an unaligned framebuffer 
position.

My question is how best should this be fixed? I know I could avoid writing 
more than 3 bytes to an unaligned framebuffer offset, but the standard write 
syscall should be able to handle this, and Documentation/unaligned-memory-
access.txt makes it clear that unaligned accesses are to be avoided and with 
good reason.

Is it possible to just copy_from_user straight into the framebuffer, or should 
I define an fb_memcpy to go with the other definitions around line 925 of 
include/linux/fb.h, or something else?

Thanks
James

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2010-09-09 22:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-09 22:38 James Hogan [this message]
2010-09-17 18:11 ` fb_write unaligned writes Florian Tobias Schandinat
2010-09-17 23:57 ` [PATCH] fbmem: Fix fb_read, fb_write unaligned accesses James Hogan
2010-09-17 23:57   ` James Hogan
2010-09-18  0:15   ` David Miller
2010-09-18  0:15     ` David Miller
2010-09-18  0:23   ` James Hogan
2010-09-18  0:23     ` James Hogan
2010-09-18  3:17     ` David Miller
2010-09-18  3:17       ` David Miller
2010-09-20 19:27     ` Florian Tobias Schandinat
2010-09-20 19:27       ` Florian Tobias Schandinat
2010-09-21 23:19     ` Andrew Morton
2010-09-21 23:19       ` Andrew Morton
2010-09-22  0:00       ` James Hogan
2010-09-22  0:00         ` James Hogan
2010-09-18  0:11 ` fb_write unaligned writes James Hogan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201009092338.59880.james@albanarts.com \
    --to=james@albanarts.com \
    --cc=linux-fbdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.