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:
signature.asc
Description: This is a digitally signed message part.