Received: by 10.213.65.68 with SMTP id h4csp20931imn; Mon, 12 Mar 2018 05:29:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELuzPCmer1l5h1PrKLduyNlpAzGJ+0cUZA97lz2aLP/xD30dwfmyuaCT/07BZwj9UibfGV0s X-Received: by 10.99.127.91 with SMTP id p27mr3216731pgn.28.1520857763898; Mon, 12 Mar 2018 05:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520857763; cv=none; d=google.com; s=arc-20160816; b=uwW7tAFd6unK48SbeSHYLld+MbuPEupzNOQePmn1o3gkeYdzhebjGa5WnxxOFwb3PP cNQHMVD9mnV9xv1+aMLrotRWwdQnMGTv0t5pRyZ4L7St8jFCbHeBZlRxcrAFifYFLMCw wkn6wUZOKhmCNrqHc3UCoJ5VIufUaKLkohHtr7UHsSQkHQ4F7TB50lzeiZl9at3q1IOa PrBOVtY6i/N7PNZqNn9ztXvAdZKw8008geLbev8PYZwVvocBMBXTtuW7cnxWugzvPu+y LWvw/wezSuG7riPD1NXWdZz4ERW9D6T2wsRUxe8cdonNch9Xr0B9knz37g5a9V9CtvDv 5AiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=/m5CF3iXfzPM/MBY781A/9o+024XPzE6Rcj9LwF9yBo=; b=tOnlEdIAqEcyPF5VPGZsvuw3Zmrbs+YsmM2/j61OE0sv57N41ebz1TXbYxGVWzB3mG kesWXi6j5LJ+gsNU9pjHRl4fYAyCzMRi6s9in3AEMZaA5n5BFDOq/+uJASHPlcWEfbqo DVCguMdtyZSPjq8dQEXjMzGQsio7+IP2kAOGEZUbbJnDDFSh/v24CxqfukYswc6kSGk+ 19Rfjl6QbHaPwGMX2zTkpa2YMqgsWrXQak9/e59Oz5x/XcLwU/4csLAWZkcDYG/EDK4J v8PAlCE9YErYBjjc9Xt8jzIapGvUIf1ErEGml5H0fGMlzd1G6FRDJb/rk/EcsTkQqagv FXUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=HmljwhD5; dkim=pass header.i=@codeaurora.org header.s=default header.b=HmljwhD5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si4978096pgc.401.2018.03.12.05.29.09; Mon, 12 Mar 2018 05:29:23 -0700 (PDT) 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=@codeaurora.org header.s=default header.b=HmljwhD5; dkim=pass header.i=@codeaurora.org header.s=default header.b=HmljwhD5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751574AbeCLM2O (ORCPT + 99 others); Mon, 12 Mar 2018 08:28:14 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:49576 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750995AbeCLM2M (ORCPT ); Mon, 12 Mar 2018 08:28:12 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BDBBA60452; Mon, 12 Mar 2018 12:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520857691; bh=BjoAn0Go8vMbXoM9fsgayU1adxW7Rj6eB7PuNKhYnC4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HmljwhD5jTT5nMRxCr502hxdh4y3975/Z3LFoBu+SnlEV4zpJzPlMz8/09rSkRORX wZT2GnoXW/fG9WygoVSIsKpAnSAAknrPFDpKfPYeaJNeG0/m62+t5N7GKofKur+0Zl IEGPg1iku8HJ4Tam4+DAGkXdK8H4YGuXcjNlAtM0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 07E13603AF; Mon, 12 Mar 2018 12:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520857691; bh=BjoAn0Go8vMbXoM9fsgayU1adxW7Rj6eB7PuNKhYnC4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HmljwhD5jTT5nMRxCr502hxdh4y3975/Z3LFoBu+SnlEV4zpJzPlMz8/09rSkRORX wZT2GnoXW/fG9WygoVSIsKpAnSAAknrPFDpKfPYeaJNeG0/m62+t5N7GKofKur+0Zl IEGPg1iku8HJ4Tam4+DAGkXdK8H4YGuXcjNlAtM0= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Mon, 12 Mar 2018 17:58:11 +0530 From: Abhishek Sahu To: Andy Gross 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 In-Reply-To: <20180227231559.GJ20901@hector.attlocal.net> References: <1517644697-30806-1-git-send-email-absahu@codeaurora.org> <1517644697-30806-10-git-send-email-absahu@codeaurora.org> <20180227231559.GJ20901@hector.attlocal.net> Message-ID: <7a25bcc7cc8b29b3a92cdb1088c556c3@codeaurora.org> X-Sender: absahu@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-02-28 04:45, Andy Gross wrote: > 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 Thanks Andy for reviewing this patch. There are EEPROM available with 1MB size like AT24CM01 in which we can read complete flash (128 KB) in single go by one transfer with 2 read messages of 64KB. Thanks, Abhishek