Received: by 10.223.185.116 with SMTP id b49csp5532679wrg; Tue, 27 Feb 2018 15:17:38 -0800 (PST) X-Google-Smtp-Source: AH8x227cNjFKJwaWiY55qXjatEv10JXQ+EqMYW2/QjflG1Zo4fBh8W398jVIbk3DLqDtC6UaRAj5 X-Received: by 10.101.86.138 with SMTP id v10mr12524701pgs.353.1519773458397; Tue, 27 Feb 2018 15:17:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519773458; cv=none; d=google.com; s=arc-20160816; b=PkkbkbxyOs5dJc/pL4S/Gsi0XELPDeIMHw9NcslleRcMbTbOjFAYbNPk1wRqoCLZ8E DOAcKO1gCr9in0fDj7DZeqba6SCH1nkbIMlmrBV+FhbSpQCIv4ITlgpjTClz5pj9MXpt jtHtci/BpZJTJExnejsHZ6iPPVtMmLnSXwuWW4r2gDSOlV26WbzqbsCFKWhfQFRpJRuo H18/3Jw+PgKxm2M9TCZRg32MVRFnDI6hdr/be3MXkIp10Ok6tG08lrUvbwezS7ElTh/M 1lfVD2oyFl62l4Iq17bLLclp8mzuCHarNYyjKZO6+OcEiaKJbyzGgUk7FWAFSd9TFLiD 25vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=/tRpwSNn4IqAofsEpDV72JXERxngHFJTdEEYhkpfEAI=; b=bIxUJR7hn47wDOKWfodOyv5TwM9x9Sgh0woB/BhGUdSXMJocKBxyAqygaAK+pYVWZL rKFvHuW/+6MbeS2FQCktIqjC7eWEOofIUAxxIz5mfRTnQmEFZHsm4C28MIGKVhOiiAkK 9tbfRLIDVnSpRuLPx6dAL3e4jW0EWdMw4d62fSAwvLAygTuuND8N726evKvCLfKDSlEH +VFQ7taKKi8EgYcrexEy8/CFPd07/7e/WkBlRHbmEJcdLa18+YvK3+dHH0YlMLfqd1Rp Wg9Ziulti3oaq+jGmTSfI2BKySpeQz+WYtRBI3hQYrNgQrC0lYJsujl6bXeSk2EN1A0p FhLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M25mn4lp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id u16si157565pfl.299.2018.02.27.15.17.23; Tue, 27 Feb 2018 15:17:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M25mn4lp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1752040AbeB0XQE (ORCPT + 99 others); Tue, 27 Feb 2018 18:16:04 -0500 Received: from mail-io0-f170.google.com ([209.85.223.170]:38862 "EHLO mail-io0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752002AbeB0XQB (ORCPT ); Tue, 27 Feb 2018 18:16:01 -0500 Received: by mail-io0-f170.google.com with SMTP id g21so1131938ioj.5 for ; Tue, 27 Feb 2018 15:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=/tRpwSNn4IqAofsEpDV72JXERxngHFJTdEEYhkpfEAI=; b=M25mn4lpuCkg6i69KHKECFyNRWX6Np+xoWxvIIK/SxvbDjdCEhBd4u/bh06D4ViAbx J7wkqV4GZFVCwH/L1pi858dvS25BufHkkK6Tq6RA3PwIlQU/98G958AmSQf3tMGkBV2I 7xIpqJ8BaN7Zy78UkTl03L2zZWXV+Pow3l/CY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=/tRpwSNn4IqAofsEpDV72JXERxngHFJTdEEYhkpfEAI=; b=MKc4uowZKYyMQX+CAGkBy7rZZ64Kuf56UKFEpWzhbjeEwes6HbwPF1EvM2CRzTMobq 2q7xpOTw83Jz0Lgv+qpTbe/5R9e/sSBNGuguXxaCzQHXX5rVPjg+rdfyQh2FR79induH ZUssLHwmme2/D18R8NcajadjnpUe9t4QzeNZDSEnVmrFhcFvOp6sBZGOQB8cBpUk5JGn PoiZPFY+D1B7rCc7sbPFrCh9uH+T43t3kpaTxwkLz4Xe9fJauO/Mt0cE0o0oRMLfkeC1 WCK778971bWLRYbUZDxLw2DOnSqF3VL/7KyZSmBgisAvVATTEhNUiID2Nf3zFHk5/4H8 sNOQ== X-Gm-Message-State: APf1xPD2mTxWeUg4Md2+v3EpsQe++LJATgzKyRJIM05w4aJuf29a0vy6 xnVO9MWeNg/uAlbQQh/rf0oPaA== X-Received: by 10.107.242.14 with SMTP id q14mr18464567ioh.240.1519773360715; Tue, 27 Feb 2018 15:16:00 -0800 (PST) Received: from localhost ([2600:1700:8c61:6240:20cb:1985:36b:544f]) by smtp.gmail.com with ESMTPSA id 87sm184059ioq.36.2018.02.27.15.16.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 15:16:00 -0800 (PST) Date: Tue, 27 Feb 2018 17:15:59 -0600 From: Andy Gross To: Abhishek Sahu Cc: Wolfram Sang , David Brown , Sricharan R , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/12] i2c: qup: fix buffer overflow for multiple msg of maximum xfer len Message-ID: <20180227231559.GJ20901@hector.attlocal.net> References: <1517644697-30806-1-git-send-email-absahu@codeaurora.org> <1517644697-30806-10-git-send-email-absahu@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1517644697-30806-10-git-send-email-absahu@codeaurora.org> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 03, 2018 at 01:28:14PM +0530, Abhishek Sahu wrote: > The BAM mode requires buffer for start tag data and tx, rx SG > list. Currently, this is being taken for maximum transfer length > (65K). But an I2C transfer can have multiple messages and each > message can be of this maximum length so the buffer overflow will > happen in this case. Since increasing buffer length won’t be > feasible since an I2C transfer can contain any number of messages > so this patch does following changes to make i2c transfers working > for multiple messages case. > > 1. Calculate the required buffers for 2 maximum length messages > (65K * 2). > 2. Split the descriptor formation and descriptor scheduling. > The idea is to fit as many messages in one DMA transfers for 65K > threshold value (max_xfer_sg_len). Whenever the sg_cnt is > crossing this, then schedule the BAM transfer and subsequent > transfer will again start from zero. > > Signed-off-by: Abhishek Sahu I'm ok with this patch. I find the idea of a > 64k size message to be something that usually wouldn't be encountered, but... with some eeproms and maybe TPMs perhaps this could happen? Reviewed-by: Andy Gross