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

Commit d994c652 authored by Matt Wagantall's avatar Matt Wagantall
Browse files

crypto: msm: ota: fix pointer truncation during casting



Several functions use an 'unsigned int' to store pointers
as an intermediate casting step. This may result in truncation.
Cast to uintptr_t instead to avoid any potential issues.

Change-Id: I228d0520e298ed1ada1f344e5efa9b2753ce2de9
Signed-off-by: default avatarMatt Wagantall <mattw@codeaurora.org>
parent 06b0f45f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ static bool _next_v_mp_req(struct ota_async_req *areq)

	p = areq->req.f8_v_mp_req.qce_f8_req.data_in;
	p += areq->req.f8_v_mp_req.qce_f8_req.data_len;
	p = (uint8_t *) ALIGN(((unsigned int)p), L1_CACHE_BYTES);
	p = (uint8_t *) ALIGN(((uintptr_t)p), L1_CACHE_BYTES);

	areq->req.f8_v_mp_req.qce_f8_req.data_out = p;
	areq->req.f8_v_mp_req.qce_f8_req.data_in = p;
@@ -628,7 +628,7 @@ static long qcota_ioctl(struct file *file,
				return -EFAULT;
			}
			p += areq.req.f8_v_mp_req.cipher_iov[i].size;
			p = (uint8_t *) ALIGN(((unsigned int)p),
			p = (uint8_t *) ALIGN(((uintptr_t)p),
							L1_CACHE_BYTES);
		}

@@ -655,7 +655,7 @@ static long qcota_ioctl(struct file *file,
				return -EFAULT;
			}
			p += areq.req.f8_v_mp_req.cipher_iov[i].size;
			p = (uint8_t *) ALIGN(((unsigned int)p),
			p = (uint8_t *) ALIGN(((uintptr_t)p),
							L1_CACHE_BYTES);
		}
		kfree(k_buf);