Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2603342pxb; Tue, 21 Sep 2021 03:42:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/zBuSHAQzemz0gEwKT/dFKz6tC29wdBkWAglPdQqxEhPuTGZ+tPMG1vGL+8e7DHdeZmZA X-Received: by 2002:a05:6602:1484:: with SMTP id a4mr3659069iow.32.1632220946867; Tue, 21 Sep 2021 03:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632220946; cv=none; d=google.com; s=arc-20160816; b=Ys/M41YAJKwM+MCVhemuvZMHmQAFVaiiZjWejexgVYYpH6+TO5gCj8jKhxyxrbI9Jt YG7gO1Sf4T83JBODZ4xwmUPlbvkCWkAdWYK8KmMe+FxuVBkMsfavzhXRW7BKknbiIsEV vIA6UXh3TzWoMb5I8MD9XtBfdgMeSGWbcvjTy2Z0Q47U70LatHP+K02NYIlboKoiiCbg rHy5er4kM9KLEX4RFC8dLMM5+iAoPN8iamm/OkTmNAgByt1MW2UPfRuiijArelcgT9Ql hu4itEkoz8+kKP7MoCmLEMZBptGnuC+c58vUtjz+E90kn8FXBBhqAqdrSRrxM6LB00h0 /KXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=/+FBrtcsk4K3OTBY/mW3qTcwRIsIjzW6KMlTO3HDIHk=; b=c28mxeT94sD0VcSXuRAGS1IYdNQt5h9sC2Xe7XWEDOghArj5mKU98mw2kdQYtVmYgF SeFv/7gCp53Riq+sS4ZqFbG43x/Sxog5Gw17iLo26oCdpPCT5qKfolEY/BRWXdN9nz6T Pzl1Is0PeRxWwPbKM3iSlPX/n09m6K4oM7yeAv1iRA5nWBmZgjhCFDr+vZw+cDsstvME 9kKo1MyPmyER+sUodhD4ymDKY/9zgl8sl2X1h9c38BCdn7Rn1zUufAJaiQD3zrxiLc5O GXpR4xhNvPsYqicVMybQgGZg9U5Prb4SiqPTK8owX+0WaHpfjAFrGM/zqAQi8GrURqMt e1Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kx0n1HsF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si16555261ils.120.2021.09.21.03.42.15; Tue, 21 Sep 2021 03:42:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kx0n1HsF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbhIUKlc (ORCPT + 99 others); Tue, 21 Sep 2021 06:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232249AbhIUKlW (ORCPT ); Tue, 21 Sep 2021 06:41:22 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DD5C0613D8 for ; Tue, 21 Sep 2021 03:39:50 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id eg28so49915131edb.1 for ; Tue, 21 Sep 2021 03:39:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=/+FBrtcsk4K3OTBY/mW3qTcwRIsIjzW6KMlTO3HDIHk=; b=Kx0n1HsF1VKUFGr5YWnVOdaM8EFzo8u/2vKbkmEjYaHZgqlhxqzkgzIewqfZXUBKpm CE0+SqMhuC4qqxSsxN7S3p0xKipxhZz/nnklfZkzH9lzpDGXk4dnbrdPfvySxF3UdZJI wnWwxC3xXlqKgTuFMc4JoIrHebC6BtQhN9+wJjxcoQJ2h2YGbsoDouU8M5ma9HbjstsI qS+s2t8wGZQ6+vru0cNjtBXwUvD+t7D5REZEl088yuWOUn6M4erqYxcvoN9cOGFggZw4 4uJzK+jB7N1KFaM7C+btFA6z3Z8rvyVmf1ZE0dTBYnq89KSHABjT5HmxNitNru7ZseoF e66Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/+FBrtcsk4K3OTBY/mW3qTcwRIsIjzW6KMlTO3HDIHk=; b=WqtmekHMZnh3/1Vn8iowyG6yi5XJ6iohmSAmTnCG1sacydPwoEYw/2G8Sa13gTQ9sk ITnyJOBAf2ANElgawE6cDk+75IxgHab+xPiSOFFugwpeURmpLoRB6bQkaY6+VPBrcUZD 3MYbNKkFjwxQ1o7EoySNe3LnwirS/7m3VKwnR+B1I2Dvc7e1MSimWyQ1sZ7vTJYXKGCj 9/sJzMCu+QzOeNF6xpdLDnQVnNny9BM/XADdgcforqWty+6vHiexGBGB2BY6pR4QQ/a9 rxiqqHn8pRyUU32F3wPjRPZmsLcCIHe/ox9px6FMTcn7AuWjUWYf962IVQGMJF9ZB2XM eKaw== X-Gm-Message-State: AOAM531FvsHV0h37Dh5jvAW4qpxmAWawkq8Ara1OBu4aYVP3oLYwF/Dw qTta7i3Jgv+z0xGQ2d/eyBxE+g== X-Received: by 2002:aa7:d2ce:: with SMTP id k14mr34994454edr.396.1632220789096; Tue, 21 Sep 2021 03:39:49 -0700 (PDT) Received: from [192.168.86.34] (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.googlemail.com with ESMTPSA id b17sm1444162edv.54.2021.09.21.03.39.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Sep 2021 03:39:48 -0700 (PDT) Subject: Re: [PATCH] misc: fastrpc: fix improper packet size calculation To: Jeya R , linux-arm-msm@vger.kernel.org Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, fastrpc.upstream@qti.qualcomm.com References: <1632220527-29547-1-git-send-email-jeyr@codeaurora.org> From: Srinivas Kandagatla Message-ID: Date: Tue, 21 Sep 2021 11:39:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <1632220527-29547-1-git-send-email-jeyr@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jeya, Can you make sure the subject line reflects the patch version that you are sending. In this case it should be "[PATCH v2] misc: fastrpc: fix improper packet size calculation" this will help reviewers and maintainers to differentiate the versions of patch. On 21/09/2021 11:35, Jeya R wrote: > The buffer list is sorted and this is not being considered while > calculating packet size. This would lead to improper copy length > calculation for non-dmaheap buffers which would eventually cause > sending improper buffers to DSP. > > Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method") > Signed-off-by: Jeya R > --- Please add changes done from v1 to v2 here. something like: Changes from v1: - bla bla bla.. > drivers/misc/fastrpc.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c > index beda610..a7e550f 100644 > --- a/drivers/misc/fastrpc.c > +++ b/drivers/misc/fastrpc.c > @@ -719,16 +719,21 @@ static int fastrpc_get_meta_size(struct fastrpc_invoke_ctx *ctx) > static u64 fastrpc_get_payload_size(struct fastrpc_invoke_ctx *ctx, int metalen) > { > u64 size = 0; > - int i; > + int oix = 0; Looks like you missed to address my previous comments. --srini > > size = ALIGN(metalen, FASTRPC_ALIGN); > - for (i = 0; i < ctx->nscalars; i++) { > + for (oix = 0; oix < ctx->nbufs; oix++) { > + int i = ctx->olaps[oix].raix; > + > + if (ctx->args[i].length == 0) > + continue; > + > if (ctx->args[i].fd == 0 || ctx->args[i].fd == -1) { > > - if (ctx->olaps[i].offset == 0) > + if (ctx->olaps[oix].offset == 0) > size = ALIGN(size, FASTRPC_ALIGN); > > - size += (ctx->olaps[i].mend - ctx->olaps[i].mstart); > + size += (ctx->olaps[oix].mend - ctx->olaps[oix].mstart); > } > } > >