From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754908AbcBCB0O (ORCPT ); Tue, 2 Feb 2016 20:26:14 -0500 Received: from v094114.home.net.pl ([79.96.170.134]:50115 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752733AbcBCB0M (ORCPT ); Tue, 2 Feb 2016 20:26:12 -0500 From: "Rafael J. Wysocki" To: Alexey Klimov Cc: linux-acpi@vger.kernel.org, jassisinghbrar@gmail.com, sudeep.holla@arm.com, ashwin.chaugule@linaro.org, pprakash@codeaurora.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND] mailbox: pcc: fix channel calculation in get_pcc_channel() Date: Wed, 03 Feb 2016 02:27:14 +0100 Message-ID: <1501192.nRtmsTZae5@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.5.0-rc1+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1454412562-28543-1-git-send-email-alexey.klimov@arm.com> References: <1454412562-28543-1-git-send-email-alexey.klimov@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, February 02, 2016 11:29:22 AM Alexey Klimov wrote: > This patch fixes the calculation of pcc_chan for non-zero id. > After the compiler ignores the (unsigned long) cast the > pcc_mbox_channels pointer is type-cast and then the type-cast > offset is added which results in address outside of the range > leading to the kernel crashing. > > We might add braces and make it: > > pcc_chan = (struct mbox_chan *) > ((unsigned long) pcc_mbox_channels + > (id * sizeof(*pcc_chan))); > > but let's go with array approach here and use id as index. > > Tested on Juno board. > > Acked-by: Sudeep Holla > Acked-by: Ashwin Chaugule > Signed-off-by: Alexey Klimov Jassi said this was applied, so I'm not taking it. Thanks, Rafael