From: Sai Prakash Ranjan Subject: Re: [PATCH] stm class: Fix out of bound access from bitmap allocation Date: Sun, 7 Apr 2019 10:01:23 +0530 Message-ID: References: <20190405122256.27840-1-saiprakash.ranjan@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US Sender: stable-owner@vger.kernel.org To: David Laight , Alexander Shishkin , Greg Kroah-Hartman , Mulu He , Tingwei Zhang , Maxime Coquelin , Alexandre Torgue , "linux-stm32@st-md-mailman.stormreply.com" , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan Cc: Rajendra Nayak , Vivek Gautam , Sibi Sankar , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" , "stable@vger.kernel.org" List-Id: linux-arm-msm@vger.kernel.org On 4/5/2019 6:44 PM, David Laight wrote: > From: Sai Prakash Ranjan >> >> diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c >> index 93ce3aa740a9..21a5838f6e67 100644 >> --- a/drivers/hwtracing/stm/core.c >> +++ b/drivers/hwtracing/stm/core.c >> @@ -168,7 +168,7 @@ static int stp_master_alloc(struct stm_device *stm, unsigned int idx) >> struct stp_master *master; >> size_t size; >> >> - size = ALIGN(stm->data->sw_nchannels, 8) / 8; >> + size = ALIGN(stm->data->sw_nchannels, STM_MASTER_SZ) / STM_MASTER_SZ; > > I'm not sure that using STP_MASTER_SZ improves readability at all. > I thought it was better to have a macro than directly specifying sizeof(unsigned long), anyways I can change it. > Is there something that gives the size of a bitmap for 'n' items? > Not sure if there is something. Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation