Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6dd47e2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drm/msm: Fix potential buffer overflow issue"

parents 041ae486 9be5b16d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -34,12 +34,15 @@ static inline void __user *to_user_ptr(u64 address)
}

static struct msm_gem_submit *submit_create(struct drm_device *dev,
		struct msm_gpu *gpu, int nr_cmds, int nr_bos)
		struct msm_gpu *gpu, uint32_t nr_cmds, uint32_t nr_bos)
{
	struct msm_gem_submit *submit;
	int sz = sizeof(*submit) + (nr_bos * sizeof(submit->bos[0])) +
	uint64_t sz = sizeof(*submit) + (nr_bos * sizeof(submit->bos[0])) +
		(nr_cmds * sizeof(submit->cmd[0]));

	if (sz > SIZE_MAX)
		return NULL;

	submit = kmalloc(sz, GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY);
	if (submit) {
		submit->dev = dev;