Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754326AbdL1XQR (ORCPT ); Thu, 28 Dec 2017 18:16:17 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:39932 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751293AbdL1XQP (ORCPT ); Thu, 28 Dec 2017 18:16:15 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1CBFE6071B Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sboyd@codeaurora.org Date: Thu, 28 Dec 2017 15:16:12 -0800 From: Stephen Boyd To: Jerome Brunet Cc: Michael Turquette , Vladimir Zapolskiy , Sylvain Lemieux , Andy Gross , David Brown , Maxime Ripard , Chen-Yu Tsai , Rob Clark , Alessandro Zummo , Alexandre Belloni , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.or, linux-rtc@vger.kernel.org Subject: Re: [PATCH] clk: divider: fix incorrect usage of container_of Message-ID: <20171228231612.GX7997@codeaurora.org> References: <20171221163054.13600-1-jbrunet@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171221163054.13600-1-jbrunet@baylibre.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 953 Lines: 25 On 12/21, Jerome Brunet wrote: > divider_recalc_rate() is an helper function used by clock divider of > different types, so the structure containing the 'hw' pointer is not > always a 'struct clk_divider' > > At the following line: > > div = _get_div(table, val, flags, divider->width); > > in several cases, the value of 'divider->width' is garbage as the actual > structure behind this memory is not a 'struct clk_divider' > > Fortunately, this width value is used by _get_val() only when > CLK_DIVIDER_MAX_AT_ZERO flag is set. This has never been the case so > far when the structure is not a 'struct clk_divider'. This is probably > why we did not notice this bug before > > Fixes: afe76c8fd030 ("clk: allow a clk divider with max divisor when zero") > Signed-off-by: Jerome Brunet > --- Applied to clk-next -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project