Skip to content

Commit

Permalink
[drm] fix 32-bit mmap issue on 64-bit kernels
Browse files Browse the repository at this point in the history
Running 32-bit userland on a 64-bit kernel resulted in the error:

    mpp_drm: mmap failed: Invalid argument

Both the pagesize_mask and the mmap call truncated the offset
value to 32 bit. This patch fixes both issues.

For details see rockchip-linux/kernel#17
  • Loading branch information
jakob-tsd committed May 29, 2017
1 parent dab3742 commit 376fb9c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion osal/allocator/allocator_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/

#define MODULE_TAG "mpp_drm"
/* Enable 64-bit mmap also when compiling for 32 bit */
#define _FILE_OFFSET_BITS 64

#include <unistd.h>
#include <string.h>
Expand Down Expand Up @@ -67,7 +69,7 @@ static int drm_ioctl(int fd, int req, void *arg)

static void* drm_mmap(int fd, size_t len, int prot, int flags, loff_t offset)
{
static unsigned long pagesize_mask = 0;
static loff_t pagesize_mask = 0;
#if !defined(__gnu_linux__)
func_mmap64 fp_mmap64 = mpp_rt_get_mmap64();
#endif
Expand Down

0 comments on commit 376fb9c

Please sign in to comment.