[PATCH] drm/prime: Support page array >= 4GB

Felix Kuehling felix.kuehling at amd.com
Mon Aug 28 15:41:48 UTC 2023


On 2023-08-21 16:02, Philip Yang wrote:
> Without unsigned long typecast, the size is passed in as zero if page
> array size >= 4GB, nr_pages >= 0x100000, then sg list converted will
> have the first and the last chunk lost.
>
> Signed-off-by: Philip Yang <Philip.Yang at amd.com>

The patch looks reasonable to me. I don't have authority to approve it. 
But FWIW,

Acked-by: Felix Kuehling <Felix.Kuehling at amd.com>

Can anyone give a Reviewed-by?

Thanks,
   Felix


> ---
>   drivers/gpu/drm/drm_prime.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index f924b8b4ab6b..2630ad2e504d 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -830,7 +830,7 @@ struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev,
>   	if (max_segment == 0)
>   		max_segment = UINT_MAX;
>   	err = sg_alloc_table_from_pages_segment(sg, pages, nr_pages, 0,
> -						nr_pages << PAGE_SHIFT,
> +						(unsigned long)nr_pages << PAGE_SHIFT,
>   						max_segment, GFP_KERNEL);
>   	if (err) {
>   		kfree(sg);


More information about the dri-devel mailing list