mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
dsp-kernel: Avoid overflow in ALIGN macro usage
Check for potential overflow before using the ALIGN macro, as it is not overflow-safe. Change-Id: Iffa1b7a01a9e072fb748c93f6625d0f1a163d0f8 Signed-off-by: Anandu Krishnan E <quic_anane@quicinc.com> (cherry picked from commit 96a6c4a8768f73ba9041c15511f0d5888507c8f4)
This commit is contained in:
parent
7d4c64f722
commit
26a278473b
1 changed files with 5 additions and 1 deletions
|
|
@ -710,8 +710,12 @@ static u64 fastrpc_get_payload_size(struct fastrpc_invoke_ctx *ctx, int metalen)
|
|||
|
||||
if (ctx->args[i].fd == 0 || ctx->args[i].fd == -1) {
|
||||
|
||||
if (ctx->olaps[oix].offset == 0)
|
||||
if (ctx->olaps[oix].offset == 0) {
|
||||
/* Check for overflow before align. */
|
||||
if (size > (ULLONG_MAX - (FASTRPC_ALIGN - 1)))
|
||||
return 0;
|
||||
size = ALIGN(size, FASTRPC_ALIGN);
|
||||
}
|
||||
|
||||
size += (ctx->olaps[oix].mend - ctx->olaps[oix].mstart);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue