tech-x11 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: radeon_bo_gem.c v1.4



Tobias Nygren writes:
> Hello,
> 
> I've debugged why libdrm from pkgsrc didn't work on Linux.
> Someone added this patch from xsrc:
> 
> http://cvsweb.netbsd.org/bsdweb.cgi/xsrc/external/mit/libdrm/dist/radeon/radeon_bo_gem.c.diff?r1=1.3&r2=1.4&only_with_tag=MAIN
> 
> 
> -    ptr = drm_mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, boi->bom->fd, args.addr_ptr);
> -    if (ptr == MAP_FAILED)
> +    r = drmMap(boi->bom->fd, args.addr_ptr, args.size, &ptr);
> +    if (r)
> 
> I think this change is wrong because args.addr_ptr can be larger than 32 bits
> here but drmMap takes "drm_handle_t" as argument 2 which is only 4 bytes wide.
> So it can truncate the value which makes the drm_mmap() inside drmMap() fail.
> 
> I will revert the change in pgksrc, perhaps it should be reverted in xsrc too.

seems reasonable.  i don't recall why i made it.
thanks for tracking this down.

(the 32-bit thing is linux specific; it's 64 bit
on netbsd.  i wonder what other drmMap()s on linux
are problematic maybe.)


.mrg.


Home | Main Index | Thread Index | Old Index