Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754263AbcLLKvw (ORCPT ); Mon, 12 Dec 2016 05:51:52 -0500 Received: from m50-134.163.com ([123.125.50.134]:43648 "EHLO m50-134.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751981AbcLLKvu (ORCPT ); Mon, 12 Dec 2016 05:51:50 -0500 Subject: Re: [PATCH v3 4/5] thermal: rockchip: optimize the conversion table To: Eduardo Valentin , Caesar Wang References: <1480331524-18741-1-git-send-email-wxt@rock-chips.com> <1480331524-18741-5-git-send-email-wxt@rock-chips.com> <20161130062911.GB28498@localhost.localdomain> Cc: heiko@sntech.de, linux-pm@vger.kernel.org, briannorris@chromium.org, linux-kernel@vger.kernel.org, smbarber@chromium.org, linux-rockchip@lists.infradead.org, rui.zhang@intel.com From: Caesar Wang Message-ID: Date: Mon, 12 Dec 2016 18:48:53 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161130062911.GB28498@localhost.localdomain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: DtGowAAnHyyVgE5YDeReJw--.43019S2 X-Coremail-Antispam: 1Uf129KBjvdXoWruFyxKFy8CFW3KF45Zr18Zrb_yoW3GwcEkr 17Xw4kXry3Ar4q9w47KFykGwsrCw1rGF18JrZFyFsFgr1a9r1UJ3W0vFy7ta4DJry7GFn7 Gr1vqa4fKrW5XjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeMa0DUUUUU== X-Originating-IP: [47.89.33.70] X-CM-SenderInfo: 5vdv3yhhz03qqrwthudrp/1tbiqwU+lVUMCPYS0wAAsj Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 737 Lines: 30 在 2016年11月30日 14:29, Eduardo Valentin 写道: > Hey, > > On Mon, Nov 28, 2016 at 07:12:03PM +0800, Caesar Wang wrote: > > > >> + num = abs(table->id[mid].code - table->id[mid + 1].code); >> + num *= temp - table->id[mid].temp; >> + denom = table->id[mid + 1].temp - table->id[mid].temp; > > isn't the above 'mid + 1' off-by-one when mid ends being == table.length - 1? > > You would be accessing table->id[table.length], which is wrong memory > access, no? Yup, that's indeed a real issue for me. FIxes on next version. Thanks. -Caesar > > > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip