You need to sign in or sign up before continuing.
提交 9936aeea 编写于 作者: I Ilia Mirkin 提交者: Ben Skeggs

drm/nouveau/nouveau: bios pointers may be unaligned, use proper accessors

This can show up on SPARC or other architectures that don't handle
unaligned accesses. The kernel normally fixes these up, but it shouldn't
have to.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96836Signed-off-by: NIlia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
上级 69b62498
...@@ -31,10 +31,8 @@ ...@@ -31,10 +31,8 @@
#define DCB_LOC_ON_CHIP 0 #define DCB_LOC_ON_CHIP 0
#define ROM16(x) le16_to_cpu(*(u16 *)&(x)) #define ROM16(x) get_unaligned_le16(&(x))
#define ROM32(x) le32_to_cpu(*(u32 *)&(x)) #define ROM32(x) get_unaligned_le32(&(x))
#define ROM48(x) ({ u8 *p = &(x); (u64)ROM16(p[4]) << 32 | ROM32(p[0]); })
#define ROM64(x) le64_to_cpu(*(u64 *)&(x))
#define ROMPTR(d,x) ({ \ #define ROMPTR(d,x) ({ \
struct nouveau_drm *drm = nouveau_drm((d)); \ struct nouveau_drm *drm = nouveau_drm((d)); \
ROM16(x) ? &drm->vbios.data[ROM16(x)] : NULL; \ ROM16(x) ? &drm->vbios.data[ROM16(x)] : NULL; \
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
*/ */
#include "mxms.h" #include "mxms.h"
#define ROM16(x) le16_to_cpu(*(u16 *)&(x)) #define ROM16(x) get_unaligned_le16(&(x))
#define ROM32(x) le32_to_cpu(*(u32 *)&(x)) #define ROM32(x) get_unaligned_le32(&(x))
static u8 * static u8 *
mxms_data(struct nvkm_mxm *mxm) mxms_data(struct nvkm_mxm *mxm)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册