Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3615268pxv; Mon, 12 Jul 2021 23:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs9x2JiTuZFCiymkB8Rm0ILnWbFSIqJkJkTrPjHdVAL7vSGSnM3oPDv4espqxM+hvKtaLE X-Received: by 2002:a92:7312:: with SMTP id o18mr1667980ilc.289.1626156279549; Mon, 12 Jul 2021 23:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626156279; cv=none; d=google.com; s=arc-20160816; b=BDVQl7JSzYGIwSBXm3D4gVuzW+OlOrmRA0O74JXiIOfsX/DN5LZxqj10y52D9QKaih Lqlcg3TLg1qcFVcJD9WNoXwmqjbheCZypGnJ5wJ/RMMq5DyDqOq5hfSo0VbFHkdMkBsA LHhRHObKJgdKP+hgQupNbMmpXk8qYJ3H61r0dzeqQ0hI+hOFUvnU4x4giHVf862Qi4/A Uh4QGWR8dUlmztwUs+wS9+T5DCe6/jULcUHzm62sOpaUbowp158fM4UHyNHJzRtU3saQ YpPUQVcaXsMgkFIXBAUgS27Kd/VBaaHarazhKFStyFS0iEpRlMUxK7Q0yvhDTgt7ep8J 2AcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=XSqB1HTIAsmUNuJPOUBQ0EM6CU6XYqHBAOUrDXhwGco=; b=aiyIjYcT8Du0P16uBjQVwVCsq6YMrlNXceh3lXo0NVnUqQqeCSmuRq/r559hrUAla/ isSXlL3OR2v5hKThvjEwIKqEMNpLbyjKesS/VrPcSBRzvXWNFSdf5ABoqbu65TkPAz8u oPrycn9ktAZjnUopbCJDZK4jhTCLA457Xnl0htHJfmBtFXXOGY2ghBO9NUHPddtvfR10 81Jma6NpCqcwi1ccoELAb3rNxC8ymz/SV+LDo5IypOVjodq7hRIxivu4hRYrHLS6Q2hm wxVXUokmkAiM7bJ0D24U+RuNXJyxb3Ohnby5aDCtmlsB7DqcX28qxBhWpp+Cr2+ezMLH m6nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pmhahn.de header.s=202002 header.b=LYIB3WsI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pmhahn.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z18si21438135jat.72.2021.07.12.23.04.27; Mon, 12 Jul 2021 23:04:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pmhahn.de header.s=202002 header.b=LYIB3WsI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pmhahn.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233310AbhGMGFU (ORCPT + 99 others); Tue, 13 Jul 2021 02:05:20 -0400 Received: from birdy.pmhahn.de ([88.198.22.186]:56930 "EHLO birdy.pmhahn.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229945AbhGMGFT (ORCPT ); Tue, 13 Jul 2021 02:05:19 -0400 Received: from [IPv6:2003:e2:7738:c200:a5ae:ca72:d4d5:6724] (p200300E27738C200A5aEcA72d4D56724.dip0.t-ipconnect.de [IPv6:2003:e2:7738:c200:a5ae:ca72:d4d5:6724]) by birdy.pmhahn.de (Postfix) with ESMTPSA id 626F62208EDA; Tue, 13 Jul 2021 08:02:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pmhahn.de; s=202002; t=1626156148; bh=HfuvmijpRKAZ3kq4/6lrXulnT7YaLAQipZHwr6kr8E4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=LYIB3WsIHggROpun740ag9e7XbypxixZ7+A8tFMhcdDqX/BKG9jLUjKLpu4NFLMvq 0tXGrnAMg2+aZO+6LulZj++mey3V94gkXReys0qXDjGag3e6HWTeYeGsiiba7VdldA g/jVYlxxKDB1N5mW512dO9HEe3FuPoERGdbfANO7vezjSLvBUWPnMD4LGDpPhOl/PW f+glKg7wSMqU4oucsqYG4AX0UTn7h4OwQBsWXjbMRQ1cL4nnfd1N377WGdmz5MzMfl ux5aZ71QWZJaLJbn6Zz7UMdsU8T1HXLDlkVmb30TTAwrjp54J2j65B5D5oHMGQRiPp 57OhLqZcJW56w== Subject: Re: [PATCH] divide by 3*sizeof(u32) when computing array_size To: Salah Triki , fabrice.gasnier@foss.st.com, thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de, lee.jones@linaro.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com Cc: linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210712231910.GA1831270@pc> From: Philipp Hahn Message-ID: Date: Tue, 13 Jul 2021 08:02:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210712231910.GA1831270@pc> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Disclaimer: I have no idea what 'pwm-stm32' is or does Am 13.07.21 um 01:19 schrieb Salah Triki: > Divide by 3*sizeof(u32) when computing array_size, since stm32_breakinput > has 3 fields of type u32. ... > --- a/drivers/pwm/pwm-stm32.c > +++ b/drivers/pwm/pwm-stm32.c > @@ -544,7 +544,7 @@ static int stm32_pwm_probe_breakinputs(struct stm32_pwm *priv, > return -EINVAL; > > priv->num_breakinputs = nb; > - array_size = nb * sizeof(struct stm32_breakinput) / sizeof(u32); > + array_size = nb * sizeof(struct stm32_breakinput) / (3 * sizeof(u32)); Maybe it's too early in the morning for me, but this does not look right: > struct stm32_breakinput { > u32 index; > u32 level; > u32 filter; > }; then "sizeof(struct stm32_breakinput)" == "(3 * sizeof(u32))", which would simply make "arrray_site := nb" ? Philipp